diff --git a/SDK/src/NDK/Systems/RenderSystem.cpp b/SDK/src/NDK/Systems/RenderSystem.cpp index 3c0f9b37b..f1852f9b9 100644 --- a/SDK/src/NDK/Systems/RenderSystem.cpp +++ b/SDK/src/NDK/Systems/RenderSystem.cpp @@ -19,8 +19,6 @@ namespace Ndk for (const Ndk::EntityHandle& camera : m_cameras) { CameraComponent& camComponent = camera->GetComponent(); - NodeComponent& cameraNode = camera->GetComponent(); - camComponent.ApplyView(); NzScene dummyScene; diff --git a/src/Nazara/Audio/Music.cpp b/src/Nazara/Audio/Music.cpp index 50bff83be..59e551e2a 100644 --- a/src/Nazara/Audio/Music.cpp +++ b/src/Nazara/Audio/Music.cpp @@ -23,7 +23,6 @@ struct NzMusicImpl std::vector chunkSamples; NzThread thread; bool loop = false; - bool paused = false; bool streaming = false; unsigned int sampleRate; }; diff --git a/src/Nazara/Core/File.cpp b/src/Nazara/Core/File.cpp index 1acee0122..45aff7fea 100644 --- a/src/Nazara/Core/File.cpp +++ b/src/Nazara/Core/File.cpp @@ -551,7 +551,6 @@ NzString NzFile::AbsolutePath(const NzString& filePath) return path; // Nous avons un chemin absolu, mais il nous faut un peu le nettoyer - unsigned int pathLen = base.GetSize(); for (unsigned int i = 0; i < sep.size(); ++i) { if (sep[i] == '.') @@ -563,12 +562,8 @@ NzString NzFile::AbsolutePath(const NzString& filePath) sep.erase(sep.begin() + i--); } - else - pathLen += sep[i].GetSize(); } - pathLen += sep.size()-1; - NzStringStream stream(base); for (unsigned int i = 0; i < sep.size(); ++i) { @@ -730,10 +725,9 @@ bool NzFile::FillHash(NzAbstractHash* hash) const nzUInt64 remainingSize = file.GetSize(); char buffer[NAZARA_CORE_FILE_BUFFERSIZE]; - unsigned int size; while (remainingSize > 0) { - size = static_cast(std::min(remainingSize, static_cast(NAZARA_CORE_FILE_BUFFERSIZE))); + unsigned int size = static_cast(std::min(remainingSize, static_cast(NAZARA_CORE_FILE_BUFFERSIZE))); if (file.Read(&buffer[0], sizeof(char), size) != sizeof(char)*size) { NazaraError("Unable to read file"); diff --git a/src/Nazara/Core/Hash/CRC32.cpp b/src/Nazara/Core/Hash/CRC32.cpp index 6021cf455..af30cb2c7 100644 --- a/src/Nazara/Core/Hash/CRC32.cpp +++ b/src/Nazara/Core/Hash/CRC32.cpp @@ -79,7 +79,7 @@ NzHashCRC32::NzHashCRC32(nzUInt32 polynomial) { table[i] = crc32_reflect(i, 8) << 24; for (unsigned int j = 0; j < 8; ++j) - table[i] = (table[i] << 1) ^ (table[i] & (1 << 31) ? polynomial : 0); + table[i] = (table[i] << 1) ^ (table[i] & ((1 << 31) ? polynomial : 0)); table[i] = crc32_reflect(table[i], 32); } diff --git a/src/Nazara/Core/Hash/SHA/Internal.cpp b/src/Nazara/Core/Hash/SHA/Internal.cpp index 922a8767d..6c3177855 100644 --- a/src/Nazara/Core/Hash/SHA/Internal.cpp +++ b/src/Nazara/Core/Hash/SHA/Internal.cpp @@ -436,16 +436,15 @@ namespace void SHA1_Update(SHA_CTX* context, const nzUInt8* data, std::size_t len) { - unsigned int freespace, usedspace; if (len == 0) /* Calling with no data is valid - we do nothing */ return; - usedspace = (context->s1.bitcount >> 3) % 64; + unsigned int usedspace = (context->s1.bitcount >> 3) % 64; if (usedspace > 0) { /* Calculate how much free space is available in the buffer */ - freespace = 64 - usedspace; + unsigned int freespace = 64 - usedspace; if (len >= freespace) { @@ -647,17 +646,15 @@ void SHA256_Internal_Transform(SHA_CTX* context, const nzUInt32* data) void SHA256_Update(SHA_CTX* context, const nzUInt8 *data, std::size_t len) { - unsigned int freespace, usedspace; - if (len == 0) /* Calling with no data is valid - we do nothing */ return; - usedspace = (context->s256.bitcount >> 3) % 64; + unsigned int usedspace = (context->s256.bitcount >> 3) % 64; if (usedspace > 0) { /* Calculate how much free space is available in the buffer */ - freespace = 64 - usedspace; + unsigned int freespace = 64 - usedspace; if (len >= freespace) { @@ -905,17 +902,15 @@ void SHA512_Internal_Transform(SHA_CTX* context, const nzUInt64* data) void SHA512_Update(SHA_CTX* context, const nzUInt8 *data, std::size_t len) { - unsigned int freespace, usedspace; - if (len == 0) /* Calling with no data is valid - we do nothing */ return; - usedspace = (context->s512.bitcount[0] >> 3) % 128; + unsigned int usedspace = (context->s512.bitcount[0] >> 3) % 128; if (usedspace > 0) { /* Calculate how much free space is available in the buffer */ - freespace = 128 - usedspace; + unsigned int freespace = 128 - usedspace; if (len >= freespace) { diff --git a/src/Nazara/Graphics/SkinningManager.cpp b/src/Nazara/Graphics/SkinningManager.cpp index a7022b85c..103c41b70 100644 --- a/src/Nazara/Graphics/SkinningManager.cpp +++ b/src/Nazara/Graphics/SkinningManager.cpp @@ -89,7 +89,6 @@ namespace pair.second.second.updated = false; break; - break; } } diff --git a/src/Nazara/Renderer/OpenGL.cpp b/src/Nazara/Renderer/OpenGL.cpp index 01f60a39f..5c8167ad8 100644 --- a/src/Nazara/Renderer/OpenGL.cpp +++ b/src/Nazara/Renderer/OpenGL.cpp @@ -781,7 +781,7 @@ bool NzOpenGL::Initialize() major = version[0] - '0'; minor = version[2] - '0'; - if (major <= 0 || major > 9) + if (major == 0 || major > 9) { NazaraError("Unable to retrieve OpenGL major version"); return false; diff --git a/src/Nazara/Renderer/Renderer.cpp b/src/Nazara/Renderer/Renderer.cpp index d536c85ba..cd3eebc05 100644 --- a/src/Nazara/Renderer/Renderer.cpp +++ b/src/Nazara/Renderer/Renderer.cpp @@ -1797,10 +1797,6 @@ bool NzRenderer::EnsureStateUpdate() if (update) { - const NzVertexDeclaration* vertexDeclaration; - unsigned int bufferOffset; - unsigned int stride; - // Pour éviter la duplication de code, on va utiliser une astuce via une boucle for for (unsigned int i = 0; i < (s_instancing ? 2 : 1); ++i) { @@ -1810,9 +1806,9 @@ bool NzRenderer::EnsureStateUpdate() NzHardwareBuffer* vertexBufferImpl = static_cast(vertexBuffer->GetBuffer()->GetImpl()); glBindBuffer(NzOpenGL::BufferTarget[nzBufferType_Vertex], vertexBufferImpl->GetOpenGLID()); - bufferOffset = vertexBuffer->GetStartOffset(); - vertexDeclaration = vertexBuffer->GetVertexDeclaration(); - stride = vertexDeclaration->GetStride(); + unsigned int bufferOffset = vertexBuffer->GetStartOffset(); + const NzVertexDeclaration* vertexDeclaration = vertexBuffer->GetVertexDeclaration(); + unsigned int stride = vertexDeclaration->GetStride(); // On définit les bornes (une fois de plus selon l'itération) unsigned int start = (i == 0) ? nzVertexComponent_FirstVertexData : nzVertexComponent_FirstInstanceData; diff --git a/src/Nazara/Renderer/Shader.cpp b/src/Nazara/Renderer/Shader.cpp index d01f1eda2..47e6b9ada 100644 --- a/src/Nazara/Renderer/Shader.cpp +++ b/src/Nazara/Renderer/Shader.cpp @@ -249,7 +249,7 @@ NzString NzShader::GetSourceCode(nzShaderStage stage) const totalLength += length - 1; } - totalLength += (m_attachedShaders[stage].size()-1)*(sizeof(sep)/sizeof(char)); + totalLength += (m_attachedShaders[stage].size()-1) * (sizeof(sep)/sizeof(char)); NzString source(totalLength, '\0'); @@ -258,7 +258,7 @@ NzString NzShader::GetSourceCode(nzShaderStage stage) const { if (offset > 0) { - std::memcpy(&source[offset], sep, sizeof(sep)/sizeof(char)); + std::memcpy(&source[offset], sep, sizeof(sep)); offset += sizeof(sep)/sizeof(char); } diff --git a/src/Nazara/Renderer/Texture.cpp b/src/Nazara/Renderer/Texture.cpp index e1b57caa9..1328a0ae4 100644 --- a/src/Nazara/Renderer/Texture.cpp +++ b/src/Nazara/Renderer/Texture.cpp @@ -963,12 +963,9 @@ bool NzTexture::Update(const nzUInt8* pixels, const NzBoxui& box, unsigned int s NazaraError("Invalid box"); return false; } - #endif - - unsigned int height = GetLevelSize(m_impl->height, level); - - #if NAZARA_RENDERER_SAFE + unsigned int width = GetLevelSize(m_impl->width, level); + unsigned int height = GetLevelSize(m_impl->height, level); unsigned int depth = (m_impl->type == nzImageType_Cubemap) ? 6 : GetLevelSize(m_impl->depth, level); if (box.x+box.width > width || box.y+box.height > height || box.z+box.depth > depth || (m_impl->type == nzImageType_Cubemap && box.depth > 1)) // Nous n'autorisons pas de modifier plus d'une face du cubemap à la fois diff --git a/src/Nazara/Utility/Algorithm.cpp b/src/Nazara/Utility/Algorithm.cpp index 28f1daf9d..04ef1d4fb 100644 --- a/src/Nazara/Utility/Algorithm.cpp +++ b/src/Nazara/Utility/Algorithm.cpp @@ -37,7 +37,7 @@ namespace class IcoSphereBuilder { public: - IcoSphereBuilder(const NzMatrix4f& matrix) : + explicit IcoSphereBuilder(const NzMatrix4f& matrix) : m_matrix(matrix) { } diff --git a/src/Nazara/Utility/Loaders/FreeType/Loader.cpp b/src/Nazara/Utility/Loaders/FreeType/Loader.cpp index b16c89d02..87df982d2 100644 --- a/src/Nazara/Utility/Loaders/FreeType/Loader.cpp +++ b/src/Nazara/Utility/Loaders/FreeType/Loader.cpp @@ -144,7 +144,6 @@ namespace // "If you want to embolden the bitmap owned by a FT_GlyphSlot_Rec, you should call FT_GlyphSlot_Own_Bitmap on the slot first" FT_GlyphSlot_Own_Bitmap(glyph); FT_Bitmap_Embolden(s_library, &glyph->bitmap, boldStrength, boldStrength); - embolden = false; } dst->advance += glyph->metrics.horiAdvance >> 6; @@ -173,7 +172,7 @@ namespace for (unsigned int y = 0; y < height; ++y) { for (unsigned int x = 0; x < width; ++x) - *pixels++ = (data[x/8] & (1 << (7 - x%8)) ? 255 : 0); + *pixels++ = (data[x/8] & ((1 << (7 - x%8)) ? 255 : 0)); data += glyph->bitmap.pitch; } diff --git a/src/Nazara/Utility/Loaders/MD5Anim/Parser.cpp b/src/Nazara/Utility/Loaders/MD5Anim/Parser.cpp index 1890f9d7f..f47522ecb 100644 --- a/src/Nazara/Utility/Loaders/MD5Anim/Parser.cpp +++ b/src/Nazara/Utility/Loaders/MD5Anim/Parser.cpp @@ -469,7 +469,7 @@ bool NzMD5AnimParser::ParseHierarchy() } char name[64]; - if (std::sscanf(&m_currentLine[0], "%s %d %u %u", &name[0], &m_joints[i].parent, &m_joints[i].flags, &m_joints[i].index) != 4) + if (std::sscanf(&m_currentLine[0], "%63s %d %u %u", &name[0], &m_joints[i].parent, &m_joints[i].flags, &m_joints[i].index) != 4) { UnrecognizedLine(true); return false; diff --git a/src/Nazara/Utility/Loaders/MD5Mesh/Parser.cpp b/src/Nazara/Utility/Loaders/MD5Mesh/Parser.cpp index 19d64d103..0533160f4 100644 --- a/src/Nazara/Utility/Loaders/MD5Mesh/Parser.cpp +++ b/src/Nazara/Utility/Loaders/MD5Mesh/Parser.cpp @@ -234,9 +234,9 @@ bool NzMD5MeshParser::ParseJoints() } char name[64]; - if (std::sscanf(&m_currentLine[0], "%s %d ( %f %f %f ) ( %f %f %f )", &name[0], &m_joints[i].parent, - &m_joints[i].bindPos.x, &m_joints[i].bindPos.y, &m_joints[i].bindPos.z, - &m_joints[i].bindOrient.x, &m_joints[i].bindOrient.y, &m_joints[i].bindOrient.z) != 8) + if (std::sscanf(&m_currentLine[0], "%63s %d ( %f %f %f ) ( %f %f %f )", &name[0], &m_joints[i].parent, + &m_joints[i].bindPos.x, &m_joints[i].bindPos.y, &m_joints[i].bindPos.z, + &m_joints[i].bindOrient.x, &m_joints[i].bindOrient.y, &m_joints[i].bindOrient.z) != 8) { UnrecognizedLine(true); return false; diff --git a/src/Nazara/Utility/SubMesh.cpp b/src/Nazara/Utility/SubMesh.cpp index e9e1c3324..224a89e94 100644 --- a/src/Nazara/Utility/SubMesh.cpp +++ b/src/Nazara/Utility/SubMesh.cpp @@ -130,10 +130,6 @@ void NzSubMesh::GenerateTangents() dv[0] = positions[iterator[1]] - pos0; dv[1] = positions[iterator[2]] - pos0; - NzVector2f duv[2]; - duv[0] = uv1 - uv0; - duv[1] = uv2 - uv0; - float ds[2]; ds[0] = uv1.x - uv0.x; ds[1] = uv2.x - uv0.x;