diff --git a/SDK/include/NDK/BaseComponent.inl b/SDK/include/NDK/BaseComponent.inl index 71f8ee2c1..341ddb651 100644 --- a/SDK/include/NDK/BaseComponent.inl +++ b/SDK/include/NDK/BaseComponent.inl @@ -26,7 +26,7 @@ namespace Ndk inline ComponentIndex BaseComponent::RegisterComponent(ComponentId id, Factory factoryFunc) { // Nous allons rajouter notre composant à la fin - ComponentIndex index = s_entries.size(); + ComponentIndex index = static_cast(s_entries.size()); s_entries.resize(index + 1); // On récupère et on affecte diff --git a/SDK/include/NDK/Components/GraphicsComponent.hpp b/SDK/include/NDK/Components/GraphicsComponent.hpp index 86cefb782..c94cec4ab 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.hpp +++ b/SDK/include/NDK/Components/GraphicsComponent.hpp @@ -40,7 +40,7 @@ namespace Ndk private: inline void InvalidateBoundingVolume(); - void InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, unsigned int index); + void InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, std::size_t index); inline void InvalidateRenderables(); inline void InvalidateTransformMatrix(); diff --git a/SDK/src/NDK/Components/GraphicsComponent.cpp b/SDK/src/NDK/Components/GraphicsComponent.cpp index e345bdb85..88ccd4ca1 100644 --- a/SDK/src/NDK/Components/GraphicsComponent.cpp +++ b/SDK/src/NDK/Components/GraphicsComponent.cpp @@ -9,7 +9,7 @@ namespace Ndk { - void GraphicsComponent::InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, unsigned int index) + void GraphicsComponent::InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, std::size_t index) { NazaraAssert(index < m_renderables.size(), "Invalid renderable index"); NazaraUnused(renderable); diff --git a/build/scripts/common.lua b/build/scripts/common.lua index 66aa12513..2b4906569 100644 --- a/build/scripts/common.lua +++ b/build/scripts/common.lua @@ -54,7 +54,7 @@ function NazaraBuild:Execute() targetdir("../extlibs/lib/" .. makeLibDir .. "/x64") configuration("vs*") - buildoptions("/MP") + buildoptions({"/MP", "/bigobj"}) -- Multiprocessus build and big .obj configuration({"vs*", "x32"}) libdirs("../extlibs/lib/msvc/x86") @@ -158,7 +158,7 @@ function NazaraBuild:Execute() buildoptions("-fvisibility=hidden") configuration("vs*") - buildoptions("/MP") -- Multiprocessus build + buildoptions({"/MP", "/bigobj"}) -- Multiprocessus build and big .obj flags("NoMinimalRebuild") defines("_CRT_SECURE_NO_WARNINGS") defines("_SCL_SECURE_NO_WARNINGS") @@ -270,7 +270,7 @@ function NazaraBuild:Execute() project(prefix .. toolTable.Name) location(_ACTION .. "/tools") - targetdir(toolTable.Directory) + targetdir(toolTable.TargetDirectory) if (toolTable.Kind == "plugin" or toolTable.Kind == "library") then kind("SharedLib") @@ -278,7 +278,7 @@ function NazaraBuild:Execute() -- Copy the tool binaries to the example folder self:MakeInstallCommands(toolTable) elseif (toolTable.Kind == "application") then - debugdir(toolTable.Directory) + debugdir(toolTable.TargetDirectory) if (toolTable.EnableConsole) then kind("ConsoleApp") else @@ -404,7 +404,7 @@ function NazaraBuild:Execute() self:MakeInstallCommands(toolTable) elseif (exampleTable.Kind == "application") then - debugdir(exampleTable.Directory) + debugdir(exampleTable.TargetDirectory) if (exampleTable.EnableConsole) then kind("ConsoleApp") else @@ -769,7 +769,7 @@ function NazaraBuild:RegisterTool(toolTable) return false, "This tool name is already in use" end - if (toolTable.Directory == nil or type(toolTable.Directory) ~= "string" or string.len(toolTable.Directory) == 0) then + if (toolTable.TargetDirectory == nil or type(toolTable.TargetDirectory) ~= "string" or string.len(toolTable.TargetDirectory) == 0) then return false, "Invalid tool directory" end @@ -907,7 +907,7 @@ function NazaraBuild:Process(infoTable) end if (infoTable.Kind == "application") then - self:AddExecutablePath(infoTable.Directory) + self:AddExecutablePath(infoTable.TargetDirectory) end return true @@ -995,8 +995,8 @@ end function NazaraBuild:SetupExampleTable(infoTable) self:SetupInfoTable(infoTable) - infoTable.Directory = "../examples/bin" infoTable.Kind = "application" + infoTable.TargetDirectory = "../examples/bin" end function NazaraBuild:SetupExtlibTable(infoTable) diff --git a/build/scripts/tools/assimp.lua b/build/scripts/tools/assimp.lua index 0eecbcd54..08688ef72 100644 --- a/build/scripts/tools/assimp.lua +++ b/build/scripts/tools/assimp.lua @@ -1,7 +1,8 @@ TOOL.Name = "Assimp" -TOOL.Directory = "../SDK/lib" +TOOL.Directory = "../plugins/Assimp" TOOL.Kind = "Plugin" +TOOL.TargetDirectory = "../SDK/lib" TOOL.Includes = { "../include", diff --git a/build/scripts/tools/ndk.lua b/build/scripts/tools/ndk.lua index d2038342b..8a40ea170 100644 --- a/build/scripts/tools/ndk.lua +++ b/build/scripts/tools/ndk.lua @@ -1,7 +1,8 @@ TOOL.Name = "SDK" -TOOL.Directory = "../SDK/lib" +TOOL.Directory = "../SDK" TOOL.Kind = "Library" +TOOL.TargetDirectory = "../SDK/lib" TOOL.Defines = { "NDK_BUILD" diff --git a/build/scripts/tools/ndk_server.lua b/build/scripts/tools/ndk_server.lua index 91a0fd170..2881c56fc 100644 --- a/build/scripts/tools/ndk_server.lua +++ b/build/scripts/tools/ndk_server.lua @@ -1,7 +1,8 @@ TOOL.Name = "SDKServer" -TOOL.Directory = "../SDK/lib" +TOOL.Directory = "../SDK" TOOL.Kind = "Library" +TOOL.TargetDirectory = "../SDK/lib" TOOL.Defines = { "NDK_BUILD", diff --git a/build/scripts/tools/unittests.lua b/build/scripts/tools/unittests.lua index 349932cb6..fc0f4bad6 100644 --- a/build/scripts/tools/unittests.lua +++ b/build/scripts/tools/unittests.lua @@ -3,6 +3,7 @@ TOOL.Name = "UnitTests" TOOL.Directory = "../tests" TOOL.EnableConsole = true TOOL.Kind = "Application" +TOOL.TargetDirectory = TOOL.Directory TOOL.Defines = { } diff --git a/include/Nazara/Core/Bitset.hpp b/include/Nazara/Core/Bitset.hpp index 3b440278c..e4e2d8042 100644 --- a/include/Nazara/Core/Bitset.hpp +++ b/include/Nazara/Core/Bitset.hpp @@ -26,9 +26,9 @@ namespace Nz class Bit; Bitset(); - explicit Bitset(unsigned int bitCount, bool val); + explicit Bitset(std::size_t bitCount, bool val); explicit Bitset(const char* bits); - Bitset(const char* bits, unsigned int bitCount); + Bitset(const char* bits, std::size_t bitCount); Bitset(const Bitset& bitset) = default; explicit Bitset(const String& bits); template Bitset(T value); @@ -36,16 +36,16 @@ namespace Nz ~Bitset() noexcept = default; void Clear() noexcept; - unsigned int Count() const; + std::size_t Count() const; void Flip(); - unsigned int FindFirst() const; - unsigned int FindNext(unsigned int bit) const; + std::size_t FindFirst() const; + std::size_t FindNext(std::size_t bit) const; - Block GetBlock(unsigned int i) const; - unsigned int GetBlockCount() const; - unsigned int GetCapacity() const; - unsigned int GetSize() const; + Block GetBlock(std::size_t i) const; + std::size_t GetBlockCount() const; + std::size_t GetCapacity() const; + std::size_t GetSize() const; void PerformsAND(const Bitset& a, const Bitset& b); void PerformsNOT(const Bitset& a); @@ -54,19 +54,19 @@ namespace Nz bool Intersects(const Bitset& bitset) const; - void Reserve(unsigned int bitCount); - void Resize(unsigned int bitCount, bool defaultVal = false); + void Reserve(std::size_t bitCount); + void Resize(std::size_t bitCount, bool defaultVal = false); void Reset(); - void Reset(unsigned int bit); + void Reset(std::size_t bit); void Set(bool val = true); - void Set(unsigned int bit, bool val = true); - void SetBlock(unsigned int i, Block block); + void Set(std::size_t bit, bool val = true); + void SetBlock(std::size_t i, Block block); void Swap(Bitset& bitset); - bool Test(unsigned int bit) const; + bool Test(std::size_t bit) const; bool TestAll() const; bool TestAny() const; bool TestNone() const; @@ -74,9 +74,9 @@ namespace Nz template T To() const; String ToString() const; - void UnboundedReset(unsigned int bit); - void UnboundedSet(unsigned int bit, bool val = true); - bool UnboundedTest(unsigned int bit) const; + void UnboundedReset(std::size_t bit); + void UnboundedSet(std::size_t bit, bool val = true); + bool UnboundedTest(std::size_t bit) const; Bit operator[](int index); bool operator[](int index) const; @@ -93,20 +93,20 @@ namespace Nz Bitset& operator^=(const Bitset& bitset); static constexpr Block fullBitMask = std::numeric_limits::max(); - static constexpr unsigned int bitsPerBlock = std::numeric_limits::digits; - static constexpr unsigned int npos = std::numeric_limits::max(); + static constexpr std::size_t bitsPerBlock = std::numeric_limits::digits; + static constexpr std::size_t npos = std::numeric_limits::max(); private: - unsigned int FindFirstFrom(unsigned int blockIndex) const; + std::size_t FindFirstFrom(std::size_t blockIndex) const; Block GetLastBlockMask() const; void ResetExtraBits(); - static unsigned int ComputeBlockCount(unsigned int bitCount); - static unsigned int GetBitIndex(unsigned int bit); - static unsigned int GetBlockIndex(unsigned int bit); + static std::size_t ComputeBlockCount(std::size_t bitCount); + static std::size_t GetBitIndex(std::size_t bit); + static std::size_t GetBlockIndex(std::size_t bit); std::vector m_blocks; - unsigned int m_bitCount; + std::size_t m_bitCount; }; template diff --git a/include/Nazara/Core/Bitset.inl b/include/Nazara/Core/Bitset.inl index f7256bdbb..21457d7c7 100644 --- a/include/Nazara/Core/Bitset.inl +++ b/include/Nazara/Core/Bitset.inl @@ -42,7 +42,7 @@ namespace Nz */ template - Bitset::Bitset(unsigned int bitCount, bool val) : + Bitset::Bitset(std::size_t bitCount, bool val) : Bitset() { Resize(bitCount, val); @@ -72,11 +72,11 @@ namespace Nz */ template - Bitset::Bitset(const char* bits, unsigned int bitCount) : + Bitset::Bitset(const char* bits, std::size_t bitCount) : m_blocks(ComputeBlockCount(bitCount), 0U), m_bitCount(bitCount) { - for (unsigned int i = 0; i < bitCount; ++i) + for (std::size_t i = 0; i < bitCount; ++i) { switch (*bits++) { @@ -126,7 +126,7 @@ namespace Nz else { // Note: I was kinda tired when I wrote this, there's probably a much easier method than checking bits to write bits - for (unsigned int bitPos = 0; bitPos < std::numeric_limits::digits; bitPos++) + for (std::size_t bitPos = 0; bitPos < std::numeric_limits::digits; bitPos++) { if (value & (T(1U) << bitPos)) UnboundedSet(bitPos, true); @@ -153,13 +153,13 @@ namespace Nz */ template - unsigned int Bitset::Count() const + std::size_t Bitset::Count() const { if (m_blocks.empty()) return 0; - unsigned int count = 0; - for (unsigned int i = 0; i < m_blocks.size(); ++i) + std::size_t count = 0; + for (std::size_t i = 0; i < m_blocks.size(); ++i) count += CountBits(m_blocks[i]); return count; @@ -184,7 +184,7 @@ namespace Nz */ template - unsigned int Bitset::FindFirst() const + std::size_t Bitset::FindFirst() const { return FindFirstFrom(0); } @@ -199,7 +199,7 @@ namespace Nz */ template - unsigned int Bitset::FindNext(unsigned int bit) const + std::size_t Bitset::FindNext(std::size_t bit) const { NazaraAssert(bit < m_bitCount, "Bit index out of range"); @@ -207,8 +207,8 @@ namespace Nz return npos; // The block of the bit and its index - unsigned int blockIndex = GetBlockIndex(bit); - unsigned int bitIndex = GetBitIndex(bit); + std::size_t blockIndex = GetBlockIndex(bit); + std::size_t bitIndex = GetBitIndex(bit); // We get the block Block block = m_blocks[blockIndex]; @@ -233,7 +233,7 @@ namespace Nz */ template - Block Bitset::GetBlock(unsigned int i) const + Block Bitset::GetBlock(std::size_t i) const { NazaraAssert(i < m_blocks.size(), "Block index out of range"); @@ -246,7 +246,7 @@ namespace Nz */ template - unsigned int Bitset::GetBlockCount() const + std::size_t Bitset::GetBlockCount() const { return m_blocks.size(); } @@ -257,7 +257,7 @@ namespace Nz */ template - unsigned int Bitset::GetCapacity() const + std::size_t Bitset::GetCapacity() const { return m_blocks.capacity()*bitsPerBlock; } @@ -268,7 +268,7 @@ namespace Nz */ template - unsigned int Bitset::GetSize() const + std::size_t Bitset::GetSize() const { return m_bitCount; } @@ -285,7 +285,7 @@ namespace Nz template void Bitset::PerformsAND(const Bitset& a, const Bitset& b) { - std::pair minmax = std::minmax(a.GetBlockCount(), b.GetBlockCount()); + std::pair minmax = std::minmax(a.GetBlockCount(), b.GetBlockCount()); // We reinitialise our blocks with zero m_blocks.clear(); @@ -293,7 +293,7 @@ namespace Nz m_bitCount = std::max(a.GetSize(), b.GetSize()); // In case of the "AND", we can stop with the smallest size (because x & 0 = 0) - for (unsigned int i = 0; i < minmax.first; ++i) + for (std::size_t i = 0; i < minmax.first; ++i) m_blocks[i] = a.GetBlock(i) & b.GetBlock(i); ResetExtraBits(); @@ -311,7 +311,7 @@ namespace Nz m_blocks.resize(a.GetBlockCount()); m_bitCount = a.GetSize(); - for (unsigned int i = 0; i < m_blocks.size(); ++i) + for (std::size_t i = 0; i < m_blocks.size(); ++i) m_blocks[i] = ~a.GetBlock(i); ResetExtraBits(); @@ -332,15 +332,15 @@ namespace Nz const Bitset& greater = (a.GetSize() > b.GetSize()) ? a : b; const Bitset& lesser = (a.GetSize() > b.GetSize()) ? b : a; - unsigned int maxBlockCount = greater.GetBlockCount(); - unsigned int minBlockCount = lesser.GetBlockCount(); + std::size_t maxBlockCount = greater.GetBlockCount(); + std::size_t minBlockCount = lesser.GetBlockCount(); m_blocks.resize(maxBlockCount); m_bitCount = greater.GetSize(); - for (unsigned int i = 0; i < minBlockCount; ++i) + for (std::size_t i = 0; i < minBlockCount; ++i) m_blocks[i] = a.GetBlock(i) | b.GetBlock(i); - for (unsigned int i = minBlockCount; i < maxBlockCount; ++i) + for (std::size_t i = minBlockCount; i < maxBlockCount; ++i) m_blocks[i] = greater.GetBlock(i); // (x | 0 = x) ResetExtraBits(); @@ -361,15 +361,15 @@ namespace Nz const Bitset& greater = (a.GetSize() > b.GetSize()) ? a : b; const Bitset& lesser = (a.GetSize() > b.GetSize()) ? b : a; - unsigned int maxBlockCount = greater.GetBlockCount(); - unsigned int minBlockCount = lesser.GetBlockCount(); + std::size_t maxBlockCount = greater.GetBlockCount(); + std::size_t minBlockCount = lesser.GetBlockCount(); m_blocks.resize(maxBlockCount); m_bitCount = greater.GetSize(); - for (unsigned int i = 0; i < minBlockCount; ++i) + for (std::size_t i = 0; i < minBlockCount; ++i) m_blocks[i] = a.GetBlock(i) ^ b.GetBlock(i); - for (unsigned int i = minBlockCount; i < maxBlockCount; ++i) + for (std::size_t i = minBlockCount; i < maxBlockCount; ++i) m_blocks[i] = greater.GetBlock(i); // (x ^ 0 = x) ResetExtraBits(); @@ -385,8 +385,8 @@ namespace Nz bool Bitset::Intersects(const Bitset& bitset) const { // We only test the blocks in common - unsigned int sharedBlocks = std::min(GetBlockCount(), bitset.GetBlockCount()); - for (unsigned int i = 0; i < sharedBlocks; ++i) + std::size_t sharedBlocks = std::min(GetBlockCount(), bitset.GetBlockCount()); + for (std::size_t i = 0; i < sharedBlocks; ++i) { Block a = GetBlock(i); Block b = bitset.GetBlock(i); @@ -404,7 +404,7 @@ namespace Nz */ template - void Bitset::Reserve(unsigned int bitCount) + void Bitset::Reserve(std::size_t bitCount) { m_blocks.reserve(ComputeBlockCount(bitCount)); } @@ -417,13 +417,13 @@ namespace Nz */ template - void Bitset::Resize(unsigned int bitCount, bool defaultVal) + void Bitset::Resize(std::size_t bitCount, bool defaultVal) { // We begin with changing the size of container, with the correct value of initialisation - unsigned int lastBlockIndex = m_blocks.size() - 1; + std::size_t lastBlockIndex = m_blocks.size() - 1; m_blocks.resize(ComputeBlockCount(bitCount), (defaultVal) ? fullBitMask : 0U); - unsigned int remainingBits = GetBitIndex(m_bitCount); + std::size_t remainingBits = GetBitIndex(m_bitCount); if (bitCount > m_bitCount && remainingBits > 0 && defaultVal) // Initialisation of unused bits in the last block before the size change m_blocks[lastBlockIndex] |= fullBitMask << remainingBits; @@ -451,7 +451,7 @@ namespace Nz */ template - void Bitset::Reset(unsigned int bit) + void Bitset::Reset(std::size_t bit) { Set(bit, false); } @@ -482,7 +482,7 @@ namespace Nz */ template - void Bitset::Set(unsigned int bit, bool val) + void Bitset::Set(std::size_t bit, bool val) { NazaraAssert(bit < m_bitCount, "Bit index out of range"); @@ -503,7 +503,7 @@ namespace Nz * \remark Produce a NazaraAssert if i is greather than number of blocks in bitset */ template - void Bitset::SetBlock(unsigned int i, Block block) + void Bitset::SetBlock(std::size_t i, Block block) { NazaraAssert(i < m_blocks.size(), "Block index out of range"); @@ -537,7 +537,7 @@ namespace Nz */ template - bool Bitset::Test(unsigned int bit) const + bool Bitset::Test(std::size_t bit) const { NazaraAssert(bit < m_bitCount, "Bit index out of range"); @@ -555,7 +555,7 @@ namespace Nz // Special case for the last block Block lastBlockMask = GetLastBlockMask(); - for (unsigned int i = 0; i < m_blocks.size(); ++i) + for (std::size_t i = 0; i < m_blocks.size(); ++i) { Block mask = (i == m_blocks.size() - 1) ? lastBlockMask : fullBitMask; if (m_blocks[i] == mask) // The extra bits are set to zero, thus we can't test without proceeding with a mask @@ -576,7 +576,7 @@ namespace Nz if (m_blocks.empty()) return false; - for (unsigned int i = 0; i < m_blocks.size(); ++i) + for (std::size_t i = 0; i < m_blocks.size(); ++i) { if (m_blocks[i]) return true; @@ -612,7 +612,7 @@ namespace Nz NazaraAssert(m_bitCount <= std::numeric_limits::digits, "Bit count cannot be greater than T bit count"); T value = 0; - for (unsigned int i = 0; i < m_blocks.size(); ++i) + for (std::size_t i = 0; i < m_blocks.size(); ++i) value |= static_cast(m_blocks[i]) << i*bitsPerBlock; return value; @@ -628,7 +628,7 @@ namespace Nz { String str(m_bitCount, '0'); - for (unsigned int i = 0; i < m_bitCount; ++i) + for (std::size_t i = 0; i < m_bitCount; ++i) { if (Test(i)) str[m_bitCount - i - 1] = '1'; // Inversion de l'indice @@ -648,7 +648,7 @@ namespace Nz */ template - void Bitset::UnboundedReset(unsigned int bit) + void Bitset::UnboundedReset(std::size_t bit) { UnboundedSet(bit, false); } @@ -665,7 +665,7 @@ namespace Nz */ template - void Bitset::UnboundedSet(unsigned int bit, bool val) + void Bitset::UnboundedSet(std::size_t bit, bool val) { if (bit < m_bitCount) Set(bit, val); @@ -687,7 +687,7 @@ namespace Nz */ template - bool Bitset::UnboundedTest(unsigned int bit) const + bool Bitset::UnboundedTest(std::size_t bit) const { if (bit < m_bitCount) return Test(bit); @@ -816,13 +816,13 @@ namespace Nz */ template - unsigned int Bitset::FindFirstFrom(unsigned int blockIndex) const + std::size_t Bitset::FindFirstFrom(std::size_t blockIndex) const { if (blockIndex >= m_blocks.size()) return npos; // We are looking for the first non-null block - unsigned int i = blockIndex; + std::size_t i = blockIndex; for (; i < m_blocks.size(); ++i) { if (m_blocks[i]) @@ -868,7 +868,7 @@ namespace Nz */ template - unsigned int Bitset::ComputeBlockCount(unsigned int bitCount) + std::size_t Bitset::ComputeBlockCount(std::size_t bitCount) { return GetBlockIndex(bitCount) + ((GetBitIndex(bitCount) != 0U) ? 1U : 0U); } @@ -879,7 +879,7 @@ namespace Nz */ template - unsigned int Bitset::GetBitIndex(unsigned int bit) + std::size_t Bitset::GetBitIndex(std::size_t bit) { return bit & (bitsPerBlock - 1U); // bit % bitsPerBlock } @@ -890,7 +890,7 @@ namespace Nz */ template - unsigned int Bitset::GetBlockIndex(unsigned int bit) + std::size_t Bitset::GetBlockIndex(std::size_t bit) { return bit / bitsPerBlock; } @@ -1106,18 +1106,18 @@ namespace Nz const Bitset& greater = (lhs.GetBlockCount() > rhs.GetBlockCount()) ? lhs : rhs; const Bitset& lesser = (lhs.GetBlockCount() > rhs.GetBlockCount()) ? rhs : lhs; - unsigned int maxBlockCount = greater.GetBlockCount(); - unsigned int minBlockCount = lesser.GetBlockCount(); + std::size_t maxBlockCount = greater.GetBlockCount(); + std::size_t minBlockCount = lesser.GetBlockCount(); // We test the blocks in common to check the equality of bits - for (unsigned int i = 0; i < minBlockCount; ++i) + for (std::size_t i = 0; i < minBlockCount; ++i) { if (lhs.GetBlock(i) != rhs.GetBlock(i)) return false; } // Now we check for the blocks that only the biggest bitset owns, and to be equal, they must be set to '0' - for (unsigned int i = minBlockCount; i < maxBlockCount; ++i) + for (std::size_t i = minBlockCount; i < maxBlockCount; ++i) if (greater.GetBlock(i)) return false; @@ -1152,20 +1152,20 @@ namespace Nz const Bitset& greater = (lhs.GetBlockCount() > rhs.GetBlockCount()) ? lhs : rhs; const Bitset& lesser = (lhs.GetBlockCount() > rhs.GetBlockCount()) ? rhs : lhs; - unsigned int maxBlockCount = greater.GetBlockCount(); - unsigned int minBlockCount = lesser.GetBlockCount(); + std::size_t maxBlockCount = greater.GetBlockCount(); + std::size_t minBlockCount = lesser.GetBlockCount(); // If the greatest bitset has a single bit active in a block outside the lesser bitset range, then it is greater - for (unsigned int i = maxBlockCount; i > minBlockCount; ++i) + for (std::size_t i = maxBlockCount; i > minBlockCount; ++i) { if (greater.GetBlock(i)) return lhs.GetBlockCount() < rhs.GetBlockCount(); } // Compare the common blocks - for (unsigned int i = 0; i < minBlockCount; ++i) + for (std::size_t i = 0; i < minBlockCount; ++i) { - unsigned int index = (minBlockCount - i - 1); // Compare from the most significant block to the less significant block + std::size_t index = (minBlockCount - i - 1); // Compare from the most significant block to the less significant block if (lhs.GetBlock(index) < rhs.GetBlock(index)) return true; } diff --git a/include/Nazara/Core/Endianness.inl b/include/Nazara/Core/Endianness.inl index ee0d094ca..67df87c45 100644 --- a/include/Nazara/Core/Endianness.inl +++ b/include/Nazara/Core/Endianness.inl @@ -33,8 +33,8 @@ namespace Nz inline void SwapBytes(void* buffer, std::size_t size) { UInt8* bytes = static_cast(buffer); - unsigned int i = 0; - unsigned int j = size - 1; + std::size_t i = 0; + std::size_t j = size - 1; while (i < j) std::swap(bytes[i++], bytes[j--]); diff --git a/include/Nazara/Core/ResourceLoader.hpp b/include/Nazara/Core/ResourceLoader.hpp index b0640dcbc..8af3e3cd3 100644 --- a/include/Nazara/Core/ResourceLoader.hpp +++ b/include/Nazara/Core/ResourceLoader.hpp @@ -39,7 +39,7 @@ namespace Nz static bool IsExtensionSupported(const String& extension); static bool LoadFromFile(Type* resource, const String& filePath, const Parameters& parameters = Parameters()); - static bool LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters = Parameters()); + static bool LoadFromMemory(Type* resource, const void* data, std::size_t size, const Parameters& parameters = Parameters()); static bool LoadFromStream(Type* resource, Stream& stream, const Parameters& parameters = Parameters()); static void RegisterLoader(ExtensionGetter extensionGetter, StreamChecker checkFunc, StreamLoader streamLoader, FileLoader fileLoader = nullptr, MemoryLoader memoryLoader = nullptr); diff --git a/include/Nazara/Core/ResourceLoader.inl b/include/Nazara/Core/ResourceLoader.inl index 74e59067d..2ac72c6df 100644 --- a/include/Nazara/Core/ResourceLoader.inl +++ b/include/Nazara/Core/ResourceLoader.inl @@ -160,7 +160,7 @@ namespace Nz * \remark Produces a NazaraError if all loaders failed or no loader was found */ template - bool ResourceLoader::LoadFromMemory(Type* resource, const void* data, unsigned int size, const Parameters& parameters) + bool ResourceLoader::LoadFromMemory(Type* resource, const void* data, std::size_t size, const Parameters& parameters) { NazaraAssert(resource, "Invalid resource"); NazaraAssert(data, "Invalid data pointer"); diff --git a/include/Nazara/Lua/LuaInstance.hpp b/include/Nazara/Lua/LuaInstance.hpp index b924f6a05..9affe6f87 100644 --- a/include/Nazara/Lua/LuaInstance.hpp +++ b/include/Nazara/Lua/LuaInstance.hpp @@ -84,7 +84,7 @@ namespace Nz bool Execute(const String& code); bool ExecuteFromFile(const String& filePath); - bool ExecuteFromMemory(const void* data, unsigned int size); + bool ExecuteFromMemory(const void* data, std::size_t size); bool ExecuteFromStream(Stream& stream); int GetAbsIndex(int index) const; @@ -142,10 +142,10 @@ namespace Nz void PushNumber(double value) const; void PushReference(int ref) const; void PushString(const char* str) const; - void PushString(const char* str, unsigned int size) const; + void PushString(const char* str, std::size_t size) const; void PushString(const String& str) const; void PushTable(unsigned int sequenceElementCount = 0, unsigned int arrayElementCount = 0) const; - void* PushUserdata(unsigned int size) const; + void* PushUserdata(std::size_t size) const; void PushValue(int index) const; void Remove(int index) const; @@ -158,7 +158,7 @@ namespace Nz void SetMetatable(const char* tname) const; void SetMetatable(const String& tname) const; void SetMetatable(int index) const; - void SetMemoryLimit(UInt32 memoryLimit); + void SetMemoryLimit(std::size_t memoryLimit); void SetTable(int index = -3) const; void SetTimeLimit(UInt32 timeLimit); @@ -185,8 +185,8 @@ namespace Nz static int ProxyFunc(lua_State* state); static void TimeLimiter(lua_State* state, lua_Debug* debug); - UInt32 m_memoryLimit; - UInt32 m_memoryUsage; + std::size_t m_memoryLimit; + std::size_t m_memoryUsage; UInt32 m_timeLimit; Clock m_clock; String m_lastError; diff --git a/include/Nazara/Renderer/Texture.hpp b/include/Nazara/Renderer/Texture.hpp index 73069aa37..2fd368b53 100644 --- a/include/Nazara/Renderer/Texture.hpp +++ b/include/Nazara/Renderer/Texture.hpp @@ -59,8 +59,8 @@ namespace Nz unsigned int GetHeight(UInt8 level = 0) const; UInt8 GetLevelCount() const; UInt8 GetMaxLevel() const; - unsigned int GetMemoryUsage() const; - unsigned int GetMemoryUsage(UInt8 level) const; + std::size_t GetMemoryUsage() const; + std::size_t GetMemoryUsage(UInt8 level) const; Vector3ui GetSize(UInt8 level = 0) const; ImageType GetType() const; unsigned int GetWidth(UInt8 level = 0) const; diff --git a/include/Nazara/Utility/AbstractAtlas.hpp b/include/Nazara/Utility/AbstractAtlas.hpp index 4d135d465..16d09235f 100644 --- a/include/Nazara/Utility/AbstractAtlas.hpp +++ b/include/Nazara/Utility/AbstractAtlas.hpp @@ -29,7 +29,7 @@ namespace Nz virtual void Clear() = 0; virtual void Free(SparsePtr rects, SparsePtr layers, unsigned int count) = 0; virtual AbstractImage* GetLayer(unsigned int layerIndex) const = 0; - virtual unsigned int GetLayerCount() const = 0; + virtual std::size_t GetLayerCount() const = 0; virtual UInt32 GetStorage() const = 0; virtual bool Insert(const Image& image, Rectui* rect, bool* flipped, unsigned int* layerIndex) = 0; diff --git a/include/Nazara/Utility/AbstractImage.hpp b/include/Nazara/Utility/AbstractImage.hpp index 3a09f3a06..93821e105 100644 --- a/include/Nazara/Utility/AbstractImage.hpp +++ b/include/Nazara/Utility/AbstractImage.hpp @@ -28,8 +28,8 @@ namespace Nz virtual unsigned int GetHeight(UInt8 level = 0) const = 0; virtual UInt8 GetLevelCount() const = 0; virtual UInt8 GetMaxLevel() const = 0; - virtual unsigned int GetMemoryUsage() const = 0; - virtual unsigned int GetMemoryUsage(UInt8 level) const = 0; + virtual std::size_t GetMemoryUsage() const = 0; + virtual std::size_t GetMemoryUsage(UInt8 level) const = 0; virtual Vector3ui GetSize(UInt8 level = 0) const = 0; virtual ImageType GetType() const = 0; virtual unsigned int GetWidth(UInt8 level = 0) const = 0; diff --git a/include/Nazara/Utility/AbstractTextDrawer.hpp b/include/Nazara/Utility/AbstractTextDrawer.hpp index ffd704f6a..9f941b9c9 100644 --- a/include/Nazara/Utility/AbstractTextDrawer.hpp +++ b/include/Nazara/Utility/AbstractTextDrawer.hpp @@ -27,10 +27,10 @@ namespace Nz virtual ~AbstractTextDrawer(); virtual const Recti& GetBounds() const = 0; - virtual Font* GetFont(unsigned int index) const = 0; - virtual unsigned int GetFontCount() const = 0; - virtual const Glyph& GetGlyph(unsigned int index) const = 0; - virtual unsigned int GetGlyphCount() const = 0; + virtual Font* GetFont(std::size_t index) const = 0; + virtual std::size_t GetFontCount() const = 0; + virtual const Glyph& GetGlyph(std::size_t index) const = 0; + virtual std::size_t GetGlyphCount() const = 0; struct Glyph { diff --git a/include/Nazara/Utility/Font.hpp b/include/Nazara/Utility/Font.hpp index 257e91245..9a226d91e 100644 --- a/include/Nazara/Utility/Font.hpp +++ b/include/Nazara/Utility/Font.hpp @@ -61,8 +61,8 @@ namespace Nz bool ExtractGlyph(unsigned int characterSize, char32_t character, UInt32 style, FontGlyph* glyph) const; const std::shared_ptr& GetAtlas() const; - unsigned int GetCachedGlyphCount(unsigned int characterSize, UInt32 style) const; - unsigned int GetCachedGlyphCount() const; + std::size_t GetCachedGlyphCount(unsigned int characterSize, UInt32 style) const; + std::size_t GetCachedGlyphCount() const; String GetFamilyName() const; int GetKerning(unsigned int characterSize, char32_t first, char32_t second) const; const Glyph& GetGlyph(unsigned int characterSize, UInt32 style, char32_t character) const; diff --git a/include/Nazara/Utility/Formats/MD5AnimParser.hpp b/include/Nazara/Utility/Formats/MD5AnimParser.hpp index cfba9fdc4..558608142 100644 --- a/include/Nazara/Utility/Formats/MD5AnimParser.hpp +++ b/include/Nazara/Utility/Formats/MD5AnimParser.hpp @@ -47,12 +47,12 @@ namespace Nz Ternary Check(); - unsigned int GetAnimatedComponentCount() const; + std::size_t GetAnimatedComponentCount() const; const Frame* GetFrames() const; - unsigned int GetFrameCount() const; - unsigned int GetFrameRate() const; + std::size_t GetFrameCount() const; + std::size_t GetFrameRate() const; const Joint* GetJoints() const; - unsigned int GetJointCount() const; + std::size_t GetJointCount() const; bool Parse(); diff --git a/include/Nazara/Utility/Formats/MD5MeshParser.hpp b/include/Nazara/Utility/Formats/MD5MeshParser.hpp index 5d114bdbb..cd2d19309 100644 --- a/include/Nazara/Utility/Formats/MD5MeshParser.hpp +++ b/include/Nazara/Utility/Formats/MD5MeshParser.hpp @@ -58,9 +58,9 @@ namespace Nz Ternary Check(); const Joint* GetJoints() const; - unsigned int GetJointCount() const; + std::size_t GetJointCount() const; const Mesh* GetMeshes() const; - unsigned int GetMeshCount() const; + std::size_t GetMeshCount() const; bool Parse(); diff --git a/include/Nazara/Utility/GuillotineImageAtlas.hpp b/include/Nazara/Utility/GuillotineImageAtlas.hpp index f26ae13ea..318b92d6b 100644 --- a/include/Nazara/Utility/GuillotineImageAtlas.hpp +++ b/include/Nazara/Utility/GuillotineImageAtlas.hpp @@ -23,16 +23,17 @@ namespace Nz GuillotineImageAtlas(); virtual ~GuillotineImageAtlas(); - void Clear(); - void Free(SparsePtr rects, SparsePtr layers, unsigned int count); + void Clear() override; + + void Free(SparsePtr rects, SparsePtr layers, unsigned int count) override; GuillotineBinPack::FreeRectChoiceHeuristic GetRectChoiceHeuristic() const; GuillotineBinPack::GuillotineSplitHeuristic GetRectSplitHeuristic() const; - AbstractImage* GetLayer(unsigned int layerIndex) const; - unsigned int GetLayerCount() const; - UInt32 GetStorage() const; + AbstractImage* GetLayer(unsigned int layerIndex) const override; + std::size_t GetLayerCount() const override; + UInt32 GetStorage() const override; - bool Insert(const Image& image, Rectui* rect, bool* flipped, unsigned int* layerIndex); + bool Insert(const Image& image, Rectui* rect, bool* flipped, unsigned int* layerIndex) override; void SetRectChoiceHeuristic(GuillotineBinPack::FreeRectChoiceHeuristic heuristic); void SetRectSplitHeuristic(GuillotineBinPack::GuillotineSplitHeuristic heuristic); diff --git a/include/Nazara/Utility/Image.hpp b/include/Nazara/Utility/Image.hpp index 65c03d6bd..d936ee4d8 100644 --- a/include/Nazara/Utility/Image.hpp +++ b/include/Nazara/Utility/Image.hpp @@ -84,8 +84,8 @@ namespace Nz unsigned int GetHeight(UInt8 level = 0) const; UInt8 GetLevelCount() const; UInt8 GetMaxLevel() const; - unsigned int GetMemoryUsage() const; - unsigned int GetMemoryUsage(UInt8 level) const; + std::size_t GetMemoryUsage() const; + std::size_t GetMemoryUsage(UInt8 level) const; Color GetPixelColor(unsigned int x, unsigned int y = 0, unsigned int z = 0) const; UInt8* GetPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, UInt8 level = 0); Vector3ui GetSize(UInt8 level = 0) const; diff --git a/include/Nazara/Utility/PixelFormat.inl b/include/Nazara/Utility/PixelFormat.inl index e384d8574..bf827c4c0 100644 --- a/include/Nazara/Utility/PixelFormat.inl +++ b/include/Nazara/Utility/PixelFormat.inl @@ -100,7 +100,7 @@ namespace Nz counter |= blueMask; counter |= alphaMask; - bitsPerPixel = counter.Count(); + bitsPerPixel = static_cast(counter.Count()); } inline bool PixelFormatInfo::Validate() const @@ -116,7 +116,7 @@ namespace Nz for (unsigned int i = 0; i < 4; ++i) { - unsigned int usedBits = masks[i]->Count(); + UInt8 usedBits = static_cast(masks[i]->Count()); if (usedBits == 0) continue; diff --git a/include/Nazara/Utility/SimpleTextDrawer.hpp b/include/Nazara/Utility/SimpleTextDrawer.hpp index f5532ca8f..b2f2bf4f9 100644 --- a/include/Nazara/Utility/SimpleTextDrawer.hpp +++ b/include/Nazara/Utility/SimpleTextDrawer.hpp @@ -32,10 +32,10 @@ namespace Nz unsigned int GetCharacterSize() const; const Color& GetColor() const; Font* GetFont() const; - Font* GetFont(unsigned int index) const override; - unsigned int GetFontCount() const override; - const Glyph& GetGlyph(unsigned int index) const override; - unsigned int GetGlyphCount() const override; + Font* GetFont(std::size_t index) const override; + std::size_t GetFontCount() const override; + const Glyph& GetGlyph(std::size_t index) const override; + std::size_t GetGlyphCount() const override; UInt32 GetStyle() const; const String& GetText() const; diff --git a/src/Nazara/Core/Win32/FileImpl.cpp b/src/Nazara/Core/Win32/FileImpl.cpp index dcce3d29a..5ed051adb 100644 --- a/src/Nazara/Core/Win32/FileImpl.cpp +++ b/src/Nazara/Core/Win32/FileImpl.cpp @@ -96,7 +96,7 @@ namespace Nz //UInt64 oldCursorPos = GetCursorPos(); DWORD read = 0; - if (ReadFile(m_handle, buffer, size, &read, nullptr)) + if (ReadFile(m_handle, buffer, static_cast(size), &read, nullptr)) { m_endOfFile = (read != size); m_endOfFileUpdated = true; @@ -191,9 +191,9 @@ namespace Nz LARGE_INTEGER cursorPos; cursorPos.QuadPart = GetCursorPos(); - LockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, size, 0); - WriteFile(m_handle, buffer, size, &written, nullptr); - UnlockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, size, 0); + LockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, static_cast(size), 0); + WriteFile(m_handle, buffer, static_cast(size), &written, nullptr); + UnlockFile(m_handle, cursorPos.LowPart, cursorPos.HighPart, static_cast(size), 0); m_endOfFileUpdated = false; diff --git a/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp b/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp index 5b5d7153d..ef83e4b28 100644 --- a/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp +++ b/src/Nazara/Core/Win32/TaskSchedulerImpl.cpp @@ -24,7 +24,7 @@ namespace Nz } #endif - s_workerCount = workerCount; + s_workerCount = static_cast(workerCount); s_doneEvents.reset(new HANDLE[workerCount]); s_workers.reset(new Worker[workerCount]); s_workerThreads.reset(new HANDLE[workerCount]); @@ -64,7 +64,7 @@ namespace Nz // On s'assure que des tâches ne sont pas déjà en cours WaitForMultipleObjects(s_workerCount, &s_doneEvents[0], true, INFINITE); - std::ldiv_t div = std::ldiv(count, s_workerCount); // Division et modulo en une opération, y'a pas de petit profit + std::lldiv_t div = std::lldiv(count, s_workerCount); // Division et modulo en une opération, y'a pas de petit profit for (std::size_t i = 0; i < s_workerCount; ++i) { // On va maintenant répartir les tâches entre chaque worker et les envoyer dans la queue de chacun @@ -78,7 +78,7 @@ namespace Nz } // On les lance une fois qu'ils sont tous initialisés (pour éviter qu'un worker ne passe en pause détectant une absence de travaux) - for (unsigned int i = 0; i < s_workerCount; ++i) + for (std::size_t i = 0; i < s_workerCount; ++i) { ResetEvent(s_doneEvents[i]); SetEvent(s_workers[i].wakeEvent); @@ -244,5 +244,5 @@ namespace Nz std::unique_ptr TaskSchedulerImpl::s_doneEvents; // Doivent être contigus std::unique_ptr TaskSchedulerImpl::s_workers; std::unique_ptr TaskSchedulerImpl::s_workerThreads; // Doivent être contigus - std::size_t TaskSchedulerImpl::s_workerCount; + DWORD TaskSchedulerImpl::s_workerCount; } diff --git a/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp b/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp index 00fdec634..aabd58b86 100644 --- a/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp +++ b/src/Nazara/Core/Win32/TaskSchedulerImpl.hpp @@ -44,7 +44,7 @@ namespace Nz static std::unique_ptr s_doneEvents; // Doivent être contigus static std::unique_ptr s_workers; static std::unique_ptr s_workerThreads; // Doivent être contigus - static std::size_t s_workerCount; + static DWORD s_workerCount; }; } diff --git a/src/Nazara/Graphics/TextSprite.cpp b/src/Nazara/Graphics/TextSprite.cpp index 3459b22cd..42dba4aaf 100644 --- a/src/Nazara/Graphics/TextSprite.cpp +++ b/src/Nazara/Graphics/TextSprite.cpp @@ -64,8 +64,8 @@ namespace Nz pair.second.used = false; // ... until they are marked as used by the drawer - unsigned int fontCount = drawer.GetFontCount(); - for (unsigned int i = 0; i < fontCount; ++i) + std::size_t fontCount = drawer.GetFontCount(); + for (std::size_t i = 0; i < fontCount; ++i) { Font* font = drawer.GetFont(i); const AbstractAtlas* atlas = font->GetAtlas().get(); @@ -95,7 +95,7 @@ namespace Nz ++atlasIt; } - unsigned int glyphCount = drawer.GetGlyphCount(); + std::size_t glyphCount = drawer.GetGlyphCount(); m_localVertices.resize(glyphCount * 4); // Reset glyph count for every texture to zero @@ -105,7 +105,7 @@ namespace Nz // Count glyph count for each texture Texture* lastTexture = nullptr; unsigned int* count = nullptr; - for (unsigned int i = 0; i < glyphCount; ++i) + for (std::size_t i = 0; i < glyphCount; ++i) { const AbstractTextDrawer::Glyph& glyph = drawer.GetGlyph(i); diff --git a/src/Nazara/Lua/LuaInstance.cpp b/src/Nazara/Lua/LuaInstance.cpp index 23f852921..0ecf4c063 100644 --- a/src/Nazara/Lua/LuaInstance.cpp +++ b/src/Nazara/Lua/LuaInstance.cpp @@ -401,7 +401,7 @@ namespace Nz return false; } - unsigned int length = static_cast(file.GetSize()); + std::size_t length = static_cast(file.GetSize()); String source(length, '\0'); @@ -416,7 +416,7 @@ namespace Nz return Execute(source); } - bool LuaInstance::ExecuteFromMemory(const void* data, unsigned int size) + bool LuaInstance::ExecuteFromMemory(const void* data, std::size_t size) { MemoryView stream(data, size); return ExecuteFromStream(stream); @@ -679,7 +679,7 @@ namespace Nz lua_pushstring(m_state, str); } - void LuaInstance::PushString(const char* str, unsigned int size) const + void LuaInstance::PushString(const char* str, std::size_t size) const { lua_pushlstring(m_state, str, size); } @@ -694,7 +694,7 @@ namespace Nz lua_createtable(m_state, sequenceElementCount, arrayElementCount); } - void* LuaInstance::PushUserdata(unsigned int size) const + void* LuaInstance::PushUserdata(std::size_t size) const { return lua_newuserdata(m_state, size); } @@ -749,7 +749,7 @@ namespace Nz lua_setmetatable(m_state, index); } - void LuaInstance::SetMemoryLimit(UInt32 memoryLimit) + void LuaInstance::SetMemoryLimit(std::size_t memoryLimit) { m_memoryLimit = memoryLimit; } @@ -860,8 +860,8 @@ namespace Nz void* LuaInstance::MemoryAllocator(void* ud, void* ptr, std::size_t osize, std::size_t nsize) { LuaInstance* instance = static_cast(ud); - UInt32& memoryLimit = instance->m_memoryLimit; - UInt32& memoryUsage = instance->m_memoryUsage; + std::size_t& memoryLimit = instance->m_memoryLimit; + std::size_t& memoryUsage = instance->m_memoryUsage; if (nsize == 0) { @@ -872,7 +872,7 @@ namespace Nz } else { - UInt32 usage = memoryUsage + nsize; + std::size_t usage = memoryUsage + nsize; if (ptr) usage -= osize; diff --git a/src/Nazara/Network/Win32/IpAddressImpl.cpp b/src/Nazara/Network/Win32/IpAddressImpl.cpp index 0fd5cd88a..cbcebb83b 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(), hostnameBuffer.size(), serviceBuffer.data(), 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/Network/Win32/SocketImpl.cpp b/src/Nazara/Network/Win32/SocketImpl.cpp index 9e5846471..ab7ba7fe3 100644 --- a/src/Nazara/Network/Win32/SocketImpl.cpp +++ b/src/Nazara/Network/Win32/SocketImpl.cpp @@ -328,7 +328,7 @@ namespace Nz return code == TRUE; } - unsigned int SocketImpl::QueryMaxDatagramSize(SocketHandle handle, SocketError* error) + std::size_t SocketImpl::QueryMaxDatagramSize(SocketHandle handle, SocketError* error) { unsigned int code; int codeLength = sizeof(code); diff --git a/src/Nazara/Renderer/Renderer.cpp b/src/Nazara/Renderer/Renderer.cpp index 1093f1fd1..e49db2cec 100644 --- a/src/Nazara/Renderer/Renderer.cpp +++ b/src/Nazara/Renderer/Renderer.cpp @@ -227,7 +227,8 @@ namespace Nz } GLenum type; - UInt8* offset = reinterpret_cast(s_indexBuffer->GetStartOffset()); + UInt8* offset = nullptr; + offset += s_indexBuffer->GetStartOffset(); if (s_indexBuffer->HasLargeIndices()) { @@ -290,7 +291,8 @@ namespace Nz } GLenum type; - UInt8* offset = reinterpret_cast(s_indexBuffer->GetStartOffset()); + UInt8* offset = nullptr; + offset += s_indexBuffer->GetStartOffset(); if (s_indexBuffer->HasLargeIndices()) { diff --git a/src/Nazara/Renderer/Texture.cpp b/src/Nazara/Renderer/Texture.cpp index 835dce85e..b8bed61a0 100644 --- a/src/Nazara/Renderer/Texture.cpp +++ b/src/Nazara/Renderer/Texture.cpp @@ -364,7 +364,7 @@ namespace Nz return Image::GetMaxLevel(m_impl->type, m_impl->width, m_impl->height, m_impl->depth); } - unsigned int Texture::GetMemoryUsage() const + std::size_t Texture::GetMemoryUsage() const { #if NAZARA_RENDERER_SAFE if (!m_impl) @@ -399,7 +399,7 @@ namespace Nz return size * PixelFormat::GetBytesPerPixel(m_impl->format); } - unsigned int Texture::GetMemoryUsage(UInt8 level) const + std::size_t Texture::GetMemoryUsage(UInt8 level) const { #if NAZARA_UTILITY_SAFE if (!m_impl) diff --git a/src/Nazara/Utility/Font.cpp b/src/Nazara/Utility/Font.cpp index a29d28671..b5914aa58 100644 --- a/src/Nazara/Utility/Font.cpp +++ b/src/Nazara/Utility/Font.cpp @@ -127,7 +127,7 @@ namespace Nz return m_atlas; } - unsigned int Font::GetCachedGlyphCount(unsigned int characterSize, UInt32 style) const + std::size_t Font::GetCachedGlyphCount(unsigned int characterSize, UInt32 style) const { UInt64 key = ComputeKey(characterSize, style); auto it = m_glyphes.find(key); @@ -137,9 +137,9 @@ namespace Nz return it->second.size(); } - unsigned int Font::GetCachedGlyphCount() const + std::size_t Font::GetCachedGlyphCount() const { - unsigned int count = 0; + std::size_t count = 0; for (auto& pair : m_glyphes) count += pair.second.size(); diff --git a/src/Nazara/Utility/Formats/MD5AnimLoader.cpp b/src/Nazara/Utility/Formats/MD5AnimLoader.cpp index d079dc426..e61f6dda2 100644 --- a/src/Nazara/Utility/Formats/MD5AnimLoader.cpp +++ b/src/Nazara/Utility/Formats/MD5AnimLoader.cpp @@ -37,10 +37,10 @@ namespace Nz } const MD5AnimParser::Frame* frames = parser.GetFrames(); - unsigned int frameCount = parser.GetFrameCount(); - unsigned int frameRate = parser.GetFrameRate(); + std::size_t frameCount = parser.GetFrameCount(); + std::size_t frameRate = parser.GetFrameRate(); const MD5AnimParser::Joint* joints = parser.GetJoints(); - unsigned int jointCount = parser.GetJointCount(); + std::size_t jointCount = parser.GetJointCount(); // À ce stade, nous sommes censés avoir assez d'informations pour créer l'animation animation->CreateSkeletal(frameCount, jointCount); @@ -59,10 +59,10 @@ namespace Nz Quaternionf rotationQuat = Quaternionf::RotationBetween(Vector3f::UnitX(), Vector3f::Forward()) * Quaternionf::RotationBetween(Vector3f::UnitZ(), Vector3f::Up()); - for (unsigned int i = 0; i < jointCount; ++i) + for (std::size_t i = 0; i < jointCount; ++i) { int parent = joints[i].parent; - for (unsigned int j = 0; j < frameCount; ++j) + for (std::size_t j = 0; j < frameCount; ++j) { SequenceJoint& sequenceJoint = sequenceJoints[j*jointCount + i]; diff --git a/src/Nazara/Utility/Formats/MD5AnimParser.cpp b/src/Nazara/Utility/Formats/MD5AnimParser.cpp index 9cd930c2e..105944858 100644 --- a/src/Nazara/Utility/Formats/MD5AnimParser.cpp +++ b/src/Nazara/Utility/Formats/MD5AnimParser.cpp @@ -48,7 +48,7 @@ namespace Nz return Ternary_False; } - unsigned int MD5AnimParser::GetAnimatedComponentCount() const + std::size_t MD5AnimParser::GetAnimatedComponentCount() const { return m_animatedComponents.size(); } @@ -58,12 +58,12 @@ namespace Nz return m_frames.data(); } - unsigned int MD5AnimParser::GetFrameCount() const + std::size_t MD5AnimParser::GetFrameCount() const { return m_frames.size(); } - unsigned int MD5AnimParser::GetFrameRate() const + std::size_t MD5AnimParser::GetFrameRate() const { return m_frameRate; } @@ -73,7 +73,7 @@ namespace Nz return m_joints.data(); } - unsigned int MD5AnimParser::GetJointCount() const + std::size_t MD5AnimParser::GetJointCount() const { return m_joints.size(); } diff --git a/src/Nazara/Utility/Formats/MD5MeshLoader.cpp b/src/Nazara/Utility/Formats/MD5MeshLoader.cpp index ce56b136a..cd8a6813a 100644 --- a/src/Nazara/Utility/Formats/MD5MeshLoader.cpp +++ b/src/Nazara/Utility/Formats/MD5MeshLoader.cpp @@ -53,15 +53,15 @@ namespace Nz const MD5MeshParser::Joint* joints = parser.GetJoints(); const MD5MeshParser::Mesh* meshes = parser.GetMeshes(); - unsigned int jointCount = parser.GetJointCount(); - unsigned int meshCount = parser.GetMeshCount(); + std::size_t jointCount = parser.GetJointCount(); + std::size_t meshCount = parser.GetMeshCount(); if (parameters.animated) { mesh->CreateSkeletal(jointCount); Skeleton* skeleton = mesh->GetSkeleton(); - for (unsigned int i = 0; i < jointCount; ++i) + for (std::size_t i = 0; i < jointCount; ++i) { Joint* joint = skeleton->GetJoint(i); @@ -82,12 +82,12 @@ namespace Nz } mesh->SetMaterialCount(meshCount); - for (unsigned int i = 0; i < meshCount; ++i) + for (std::size_t i = 0; i < meshCount; ++i) { const MD5MeshParser::Mesh& md5Mesh = meshes[i]; - unsigned int indexCount = md5Mesh.triangles.size()*3; - unsigned int vertexCount = md5Mesh.vertices.size(); + std::size_t indexCount = md5Mesh.triangles.size()*3; + std::size_t vertexCount = md5Mesh.vertices.size(); bool largeIndices = (vertexCount > std::numeric_limits::max()); @@ -227,11 +227,11 @@ namespace Nz } mesh->SetMaterialCount(meshCount); - for (unsigned int i = 0; i < meshCount; ++i) + for (std::size_t i = 0; i < meshCount; ++i) { const MD5MeshParser::Mesh& md5Mesh = meshes[i]; - unsigned int indexCount = md5Mesh.triangles.size()*3; - unsigned int vertexCount = md5Mesh.vertices.size(); + std::size_t indexCount = md5Mesh.triangles.size()*3; + std::size_t vertexCount = md5Mesh.vertices.size(); // Index buffer bool largeIndices = (vertexCount > std::numeric_limits::max()); diff --git a/src/Nazara/Utility/Formats/MD5MeshParser.cpp b/src/Nazara/Utility/Formats/MD5MeshParser.cpp index 56e384bf0..b4fd04a33 100644 --- a/src/Nazara/Utility/Formats/MD5MeshParser.cpp +++ b/src/Nazara/Utility/Formats/MD5MeshParser.cpp @@ -58,7 +58,7 @@ namespace Nz return m_joints.data(); } - unsigned int MD5MeshParser::GetJointCount() const + std::size_t MD5MeshParser::GetJointCount() const { return m_joints.size(); } @@ -68,7 +68,7 @@ namespace Nz return m_meshes.data(); } - unsigned int MD5MeshParser::GetMeshCount() const + std::size_t MD5MeshParser::GetMeshCount() const { return m_meshes.size(); } diff --git a/src/Nazara/Utility/GuillotineImageAtlas.cpp b/src/Nazara/Utility/GuillotineImageAtlas.cpp index 35beab566..b3e630921 100644 --- a/src/Nazara/Utility/GuillotineImageAtlas.cpp +++ b/src/Nazara/Utility/GuillotineImageAtlas.cpp @@ -70,7 +70,7 @@ namespace Nz return layer.image.get(); } - unsigned int GuillotineImageAtlas::GetLayerCount() const + std::size_t GuillotineImageAtlas::GetLayerCount() const { return m_layers.size(); } diff --git a/src/Nazara/Utility/Image.cpp b/src/Nazara/Utility/Image.cpp index c8f3e49f1..9e0213cf6 100644 --- a/src/Nazara/Utility/Image.cpp +++ b/src/Nazara/Utility/Image.cpp @@ -666,7 +666,7 @@ namespace Nz return GetMaxLevel(m_sharedImage->type, m_sharedImage->width, m_sharedImage->height, m_sharedImage->depth); } - unsigned int Image::GetMemoryUsage() const + std::size_t Image::GetMemoryUsage() const { unsigned int width = m_sharedImage->width; unsigned int height = m_sharedImage->height; @@ -693,7 +693,7 @@ namespace Nz return size * PixelFormat::GetBytesPerPixel(m_sharedImage->format); } - unsigned int Image::GetMemoryUsage(UInt8 level) const + std::size_t Image::GetMemoryUsage(UInt8 level) const { return PixelFormat::ComputeSize(m_sharedImage->format, GetLevelSize(m_sharedImage->width, level), GetLevelSize(m_sharedImage->height, level), ((m_sharedImage->type == ImageType_Cubemap) ? 6 : GetLevelSize(m_sharedImage->depth, level))); } diff --git a/src/Nazara/Utility/SimpleTextDrawer.cpp b/src/Nazara/Utility/SimpleTextDrawer.cpp index ae2dc8762..03a95f35a 100644 --- a/src/Nazara/Utility/SimpleTextDrawer.cpp +++ b/src/Nazara/Utility/SimpleTextDrawer.cpp @@ -72,19 +72,19 @@ namespace Nz return m_font; } - Font* SimpleTextDrawer::GetFont(unsigned int index) const + Font* SimpleTextDrawer::GetFont(std::size_t index) const { NazaraAssert(index == 0, "Font index out of range"); return m_font; } - unsigned int SimpleTextDrawer::GetFontCount() const + std::size_t SimpleTextDrawer::GetFontCount() const { return 1; } - const AbstractTextDrawer::Glyph& SimpleTextDrawer::GetGlyph(unsigned int index) const + const AbstractTextDrawer::Glyph& SimpleTextDrawer::GetGlyph(std::size_t index) const { if (!m_glyphUpdated) UpdateGlyphs(); @@ -94,7 +94,7 @@ namespace Nz return m_glyphs[index]; } - unsigned int SimpleTextDrawer::GetGlyphCount() const + std::size_t SimpleTextDrawer::GetGlyphCount() const { if (!m_glyphUpdated) UpdateGlyphs(); diff --git a/src/Nazara/Utility/Win32/WindowImpl.cpp b/src/Nazara/Utility/Win32/WindowImpl.cpp index 2bf9c9d02..b494a7789 100644 --- a/src/Nazara/Utility/Win32/WindowImpl.cpp +++ b/src/Nazara/Utility/Win32/WindowImpl.cpp @@ -394,7 +394,7 @@ namespace Nz void WindowImpl::SetMaximumSize(int width, int height) { RECT rect = {0, 0, width, height}; - AdjustWindowRect(&rect, GetWindowLongPtr(m_handle, GWL_STYLE), false); + AdjustWindowRect(&rect, static_cast(GetWindowLongPtr(m_handle, GWL_STYLE)), false); if (width != -1) m_maxSize.x = rect.right-rect.left; @@ -410,7 +410,7 @@ namespace Nz void WindowImpl::SetMinimumSize(int width, int height) { RECT rect = {0, 0, width, height}; - AdjustWindowRect(&rect, GetWindowLongPtr(m_handle, GWL_STYLE), false); + AdjustWindowRect(&rect, static_cast(GetWindowLongPtr(m_handle, GWL_STYLE)), false); if (width != -1) m_minSize.x = rect.right-rect.left; @@ -432,7 +432,7 @@ namespace Nz { // SetWindowPos demande la taille totale de la fenêtre RECT rect = {0, 0, static_cast(width), static_cast(height)}; - AdjustWindowRect(&rect, GetWindowLongPtr(m_handle, GWL_STYLE), false); + AdjustWindowRect(&rect, static_cast(GetWindowLongPtr(m_handle, GWL_STYLE)), false); SetWindowPos(m_handle, nullptr, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); }