From 840b03691a4ff174a2c68c8138e45938cc4bd1d4 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 18 May 2016 00:44:58 +0200 Subject: [PATCH 1/2] Plugins/Assimp: Fix stack corruption Former-commit-id: 15b1c22cd0bbb1601e23b1e4bd037fe0cc13ab24 --- build/scripts/features/index_template.html | 140 ++++++------ build/scripts/features/style.css | 240 ++++++++++----------- plugins/Assimp/Plugin.cpp | 12 +- 3 files changed, 196 insertions(+), 196 deletions(-) diff --git a/build/scripts/features/index_template.html b/build/scripts/features/index_template.html index 43bf5aea9..852811a4c 100644 --- a/build/scripts/features/index_template.html +++ b/build/scripts/features/index_template.html @@ -1,71 +1,71 @@ - - - - - - Avancement de Nazara - - -
- Nazara Engine - -
- - Retrouvez le moteur sur GitHub !
- Dépôt GitHub

- Venez vous renseigner sur les topics dédiés à Nazara présents sur plusieurs sites web :
- OpenClassrooms, Progdupeupl ou ZesteDeSavoir -

- ... ou pourquoi ne pas venir faire un tour sur le forum dédié au moteur ? - -
- -

Fonctionnalités de Nazara

- -
Dernière mise à jour : - %DATE% -
- -

Important:

-

Afin de faciliter la mise à jour, la page que vous voyez ici a été générée automatiquement par un script Lua, ce qui m'oblige néanmoins à encoder les fonctionnalités de chaque module dans un premier temps. - C'est un travail assez long (pour vous donner une idée, les données du noyau représentent un fichier de 200 lignes), et il n'est pas encore complet, c'est pourquoi des modules manquent sur cette page.
- Gardez donc à l'esprit que le moteur possède plus de fonctionnalités que ce qui est décrit actuellement sur cette page.

- -

Oh et bien sûr je ne suis pas concepteur de site web, c'est pourquoi cette page est moche (j'ai essayé de minimiser les dégâts).
- Si vous sentez en vous l'irrésistible envie d'améliorer cette page, sachez que votre aide serait grandement appréciée (vous pouvez me contacter via le lien de votre choix plus haut).

- -

Le pourcentage indiqué est calculé automatiquement en fonction des fonctionnalités, cela signifie qu'une fonctionnalité présente sera comptée à 100% à partir du moment où son implémentation de base est considérée fonctionnelle, cela n'est donc pas une assurance qu'aucun bug n'existe concernant cette fonctionnalité (cependant cela signifie que la fonctionnalité est utilisable).
- Et bien entendu, un module ou une fonctionnalité ayant atteint les 100% peut toujours évoluer par la suite.

- -
- - - - - - - - - - - %MODULELIST% - -
Sommaire
ModuleAvancement
- - %MODULEDESCRIPTION% -
- - - - - - - - - - %MODULELIST% - -
Sommaire
ModulePourcentage
-
- + + + + + + Avancement de Nazara + + +
+ Nazara Engine + +
+ + Retrouvez le moteur sur GitHub !
+ Dépôt GitHub

+ Venez vous renseigner sur les topics dédiés à Nazara présents sur plusieurs sites web :
+ OpenClassrooms, Progdupeupl ou ZesteDeSavoir +

+ ... ou pourquoi ne pas venir faire un tour sur le forum dédié au moteur ? + +
+ +

Fonctionnalités de Nazara

+ +
Dernière mise à jour : + %DATE% +
+ +

Important:

+

Afin de faciliter la mise à jour, la page que vous voyez ici a été générée automatiquement par un script Lua, ce qui m'oblige néanmoins à encoder les fonctionnalités de chaque module dans un premier temps. + C'est un travail assez long (pour vous donner une idée, les données du noyau représentent un fichier de 200 lignes), et il n'est pas encore complet, c'est pourquoi des modules manquent sur cette page.
+ Gardez donc à l'esprit que le moteur possède plus de fonctionnalités que ce qui est décrit actuellement sur cette page.

+ +

Oh et bien sûr je ne suis pas concepteur de site web, c'est pourquoi cette page est moche (j'ai essayé de minimiser les dégâts).
+ Si vous sentez en vous l'irrésistible envie d'améliorer cette page, sachez que votre aide serait grandement appréciée (vous pouvez me contacter via le lien de votre choix plus haut).

+ +

Le pourcentage indiqué est calculé automatiquement en fonction des fonctionnalités, cela signifie qu'une fonctionnalité présente sera comptée à 100% à partir du moment où son implémentation de base est considérée fonctionnelle, cela n'est donc pas une assurance qu'aucun bug n'existe concernant cette fonctionnalité (cependant cela signifie que la fonctionnalité est utilisable).
+ Et bien entendu, un module ou une fonctionnalité ayant atteint les 100% peut toujours évoluer par la suite.

+ +
+ + + + + + + + + + + %MODULELIST% + +
Sommaire
ModuleAvancement
+ + %MODULEDESCRIPTION% +
+ + + + + + + + + + %MODULELIST% + +
Sommaire
ModulePourcentage
+
+ \ No newline at end of file diff --git a/build/scripts/features/style.css b/build/scripts/features/style.css index ff83f706c..189b2a090 100644 --- a/build/scripts/features/style.css +++ b/build/scripts/features/style.css @@ -1,121 +1,121 @@ -/* Je ne suis pas développeur HTML/CSS, je dois y toucher une fois l'an, désolé pour les quelques atrocités que vous pourrez trouver ici */ - -body -{ - font-family: sans-serif; - text-align: center; - margin: 0; - background-color: #f1f1f1; -} - -#englob { - display: block; - margin-left: auto; - margin-right: auto; - background-color: white; - width: 50%; - min-width: 765px; - padding: 0 20px; -} - -hr { - height: 0; - border: 0; - border-top: 1px solid #eee; -} - -a -{ - color: #007ACC; -} - -a:hover -{ - color: lightblue; -} - -h1 -{ - display: inline; -} - -h2 -{ - display: inline; - text-decoration: underline; -} - -h4 -{ - text-decoration: underline; -} - -p { - text-align: justify; -} - -ol -{ - list-style-type: none; -} - -table -{ - border-collapse: collapse; - text-align: center; - display: inline-block; - border: white groove; - border-radius: 10px; - box-shadow: 0px 0px 10px lightblue; -} - -th -{ - text-shadow: 2px 2px 4px black; -} - -tr -{ - border: 1px solid white; -} - -tbody tr:hover -{ - text-shadow: 0px 0px 4px white; -} - -.description -{ - margin-left: 20px; -} - -.lastupdate -{ - font-size: x-large; - font-weight: bold; - color: #f1c40f; -} - -.modulename -{ - font-size: x-large; - font-weight: bold; - text-shadow: 2px 2px 10px #007ACC; -} - -.note -{ - margin-left: 20px; - color: #007ACC; -} - -.notedesc -{ - color: rgb(200, 200, 255); -} - -.portability -{ - margin-left: 20px; - color: red; +/* Je ne suis pas développeur HTML/CSS, je dois y toucher une fois l'an, désolé pour les quelques atrocités que vous pourrez trouver ici */ + +body +{ + font-family: sans-serif; + text-align: center; + margin: 0; + background-color: #f1f1f1; +} + +#englob { + display: block; + margin-left: auto; + margin-right: auto; + background-color: white; + width: 50%; + min-width: 765px; + padding: 0 20px; +} + +hr { + height: 0; + border: 0; + border-top: 1px solid #eee; +} + +a +{ + color: #007ACC; +} + +a:hover +{ + color: lightblue; +} + +h1 +{ + display: inline; +} + +h2 +{ + display: inline; + text-decoration: underline; +} + +h4 +{ + text-decoration: underline; +} + +p { + text-align: justify; +} + +ol +{ + list-style-type: none; +} + +table +{ + border-collapse: collapse; + text-align: center; + display: inline-block; + border: white groove; + border-radius: 10px; + box-shadow: 0px 0px 10px lightblue; +} + +th +{ + text-shadow: 2px 2px 4px black; +} + +tr +{ + border: 1px solid white; +} + +tbody tr:hover +{ + text-shadow: 0px 0px 4px white; +} + +.description +{ + margin-left: 20px; +} + +.lastupdate +{ + font-size: x-large; + font-weight: bold; + color: #f1c40f; +} + +.modulename +{ + font-size: x-large; + font-weight: bold; + text-shadow: 2px 2px 10px #007ACC; +} + +.note +{ + margin-left: 20px; + color: #007ACC; +} + +.notedesc +{ + color: rgb(200, 200, 255); +} + +.portability +{ + margin-left: 20px; + color: red; } \ No newline at end of file diff --git a/plugins/Assimp/Plugin.cpp b/plugins/Assimp/Plugin.cpp index 1c998e91c..68c443b29 100644 --- a/plugins/Assimp/Plugin.cpp +++ b/plugins/Assimp/Plugin.cpp @@ -206,8 +206,8 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters) { aiVector3D position = iMesh->mVertices[j]; aiVector3D normal = iMesh->mNormals[j]; - aiVector3D tangent = iMesh->mTangents[j]; - aiVector3D uv = iMesh->mTextureCoords[0][j]; + aiVector3D tangent = (iMesh->HasTangentsAndBitangents()) ? iMesh->mTangents[j] : aiVector3D(0.f, 1.f, 0.f); + aiVector3D uv = (iMesh->HasTextureCoords(0)) ? iMesh->mTextureCoords[0][j] : aiVector3D(0.f); vertex->position = parameters.scale * Vector3f(position.x, position.y, position.z); vertex->normal.Set(normal.x, normal.y, normal.z); @@ -246,8 +246,8 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters) auto ConvertTexture = [&] (aiTextureType aiType, const char* textureKey, const char* wrapKey = nullptr) { aiString path; - aiTextureMapMode mapMode; - if (aiGetMaterialTexture(aiMat, aiType, 0, &path, nullptr, nullptr, nullptr, nullptr, &mapMode, nullptr) == aiReturn_SUCCESS) + aiTextureMapMode mapMode[3]; + if (aiGetMaterialTexture(aiMat, aiType, 0, &path, nullptr, nullptr, nullptr, nullptr, &mapMode[0], nullptr) == aiReturn_SUCCESS) { matData.SetParameter(MaterialData::CustomDefined); matData.SetParameter(textureKey, stream.GetDirectory() + String(path.data, path.length)); @@ -255,7 +255,7 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters) if (wrapKey) { SamplerWrap wrap = SamplerWrap_Default; - switch (mapMode) + switch (mapMode[0]) { case aiTextureMapMode_Clamp: case aiTextureMapMode_Decal: @@ -271,7 +271,7 @@ bool Load(Mesh* mesh, Stream& stream, const MeshParams& parameters) break; default: - NazaraWarning("Assimp texture map mode 0x" + String::Number(mapMode, 16) + " not handled"); + NazaraWarning("Assimp texture map mode 0x" + String::Number(mapMode[0], 16) + " not handled"); break; } From 8a3339badf88a01c22bc7ba8be65db1f4609e6d6 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 25 May 2016 13:52:10 +0200 Subject: [PATCH 2/2] Fix some GCC warnings Former-commit-id: 31c8460b4656c29ac165d7aa28f335851f2565df --- .../NDK/Components/CameraComponent.inl | 4 +- .../NDK/Components/GraphicsComponent.inl | 3 +- SDK/include/NDK/LuaAPI.inl | 4 ++ SDK/src/NDK/Console.cpp | 5 +++ SDK/src/NDK/LuaBinding.cpp | 4 +- SDK/src/NDK/LuaBinding_Audio.cpp | 18 +++++---- SDK/src/NDK/LuaBinding_Math.cpp | 38 ++++++++++++++++++- include/Nazara/Core/Algorithm.inl | 4 +- include/Nazara/Core/HandledObject.inl | 3 +- include/Nazara/Graphics/Light.inl | 2 +- include/Nazara/Lua/LuaClass.inl | 10 +++-- include/Nazara/Network/IpAddress.inl | 8 ++-- include/Nazara/Network/TcpClient.hpp | 2 +- include/Nazara/Utility/PixelFormat.inl | 28 +++++++------- src/Nazara/Core/File.cpp | 6 +-- src/Nazara/Core/ParameterList.cpp | 13 +++++-- src/Nazara/Graphics/ForwardRenderQueue.cpp | 6 +-- src/Nazara/Renderer/RenderTexture.cpp | 5 ++- src/Nazara/Utility/AlgorithmUtility.cpp | 4 +- 19 files changed, 113 insertions(+), 54 deletions(-) diff --git a/SDK/include/NDK/Components/CameraComponent.inl b/SDK/include/NDK/Components/CameraComponent.inl index d3bb9177e..d91c357eb 100644 --- a/SDK/include/NDK/Components/CameraComponent.inl +++ b/SDK/include/NDK/Components/CameraComponent.inl @@ -11,8 +11,8 @@ namespace Ndk inline CameraComponent::CameraComponent() : m_projectionType(Nz::ProjectionType_Perspective), m_targetRegion(0.f, 0.f, 1.f, 1.f), - m_size(0.f), m_target(nullptr), + m_size(0.f), m_frustumUpdated(false), m_projectionMatrixUpdated(false), m_viewMatrixUpdated(false), @@ -30,8 +30,8 @@ namespace Ndk AbstractViewer(camera), m_projectionType(camera.m_projectionType), m_targetRegion(camera.m_targetRegion), - m_size(camera.m_size), m_target(nullptr), + m_size(camera.m_size), m_frustumUpdated(false), m_projectionMatrixUpdated(false), m_viewMatrixUpdated(false), diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index 205eb9462..c330da5eb 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -8,6 +8,7 @@ namespace Ndk { inline GraphicsComponent::GraphicsComponent(const GraphicsComponent& graphicsComponent) : Component(graphicsComponent), + HandledObject(graphicsComponent), m_boundingVolume(graphicsComponent.m_boundingVolume), m_transformMatrix(graphicsComponent.m_transformMatrix), m_boundingVolumeUpdated(graphicsComponent.m_boundingVolumeUpdated), @@ -41,7 +42,7 @@ namespace Ndk r.data.renderOrder = renderOrder; r.renderable = std::move(renderable); r.renderableInvalidationSlot.Connect(r.renderable->OnInstancedRenderableInvalidateData, std::bind(&GraphicsComponent::InvalidateRenderableData, this, std::placeholders::_1, std::placeholders::_2, m_renderables.size()-1)); - + InvalidateBoundingVolume(); } diff --git a/SDK/include/NDK/LuaAPI.inl b/SDK/include/NDK/LuaAPI.inl index ae2da917c..a42479cae 100644 --- a/SDK/include/NDK/LuaAPI.inl +++ b/SDK/include/NDK/LuaAPI.inl @@ -84,8 +84,12 @@ namespace Nz inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, FontParams* params, TypeTag) { + NazaraUnused(params); + instance.CheckType(index, Nz::LuaType_Table); + // Structure is empty for now + return 1; } diff --git a/SDK/src/NDK/Console.cpp b/SDK/src/NDK/Console.cpp index 24a5d8df2..48ad10196 100644 --- a/SDK/src/NDK/Console.cpp +++ b/SDK/src/NDK/Console.cpp @@ -145,6 +145,7 @@ namespace Ndk { case Nz::Keyboard::Down: case Nz::Keyboard::Up: + { if (event.key.code == Nz::Keyboard::Up) m_historyPosition = std::min(m_commandHistory.size(), m_historyPosition + 1); else @@ -159,6 +160,10 @@ namespace Ndk m_inputDrawer.SetText(s_inputPrefix + text); m_inputTextSprite->Update(m_inputDrawer); break; + } + + default: + break; } break; } diff --git a/SDK/src/NDK/LuaBinding.cpp b/SDK/src/NDK/LuaBinding.cpp index 33c70dbe1..6acc05a46 100644 --- a/SDK/src/NDK/LuaBinding.cpp +++ b/SDK/src/NDK/LuaBinding.cpp @@ -29,8 +29,8 @@ namespace Ndk // SDK application("Application"), - nodeComponent("NodeComponent"), entityClass("Entity"), + nodeComponent("NodeComponent"), velocityComponent("VelocityComponent"), worldClass("World") @@ -39,9 +39,9 @@ namespace Ndk // Audio musicClass("Music"), + soundClass("Sound"), soundBuffer("SoundBuffer"), soundEmitter("SoundEmitter"), - soundClass("Sound"), // Graphics instancedRenderable("InstancedRenderable"), diff --git a/SDK/src/NDK/LuaBinding_Audio.cpp b/SDK/src/NDK/LuaBinding_Audio.cpp index d75c8215e..89452d720 100644 --- a/SDK/src/NDK/LuaBinding_Audio.cpp +++ b/SDK/src/NDK/LuaBinding_Audio.cpp @@ -76,6 +76,8 @@ namespace Ndk /*********************************** Nz::SoundBuffer **********************************/ soundBuffer.SetConstructor([] (Nz::LuaInstance& lua, Nz::SoundBufferRef* instance) { + NazaraUnused(lua); + Nz::PlacementNew(instance, Nz::SoundBuffer::New()); return true; }); @@ -115,16 +117,16 @@ namespace Ndk return 1; }); - soundBuffer.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& soundBuffer) -> int + soundBuffer.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& instance) -> int { Nz::StringStream stream("SoundBuffer("); - if (soundBuffer->IsValid()) + if (instance->IsValid()) { - Nz::String filePath = soundBuffer->GetFilePath(); + Nz::String filePath = instance->GetFilePath(); if (!filePath.IsEmpty()) stream << "File: " << filePath << ", "; - - stream << "Duration: " << soundBuffer->GetDuration() / 1000.f << "s"; + + stream << "Duration: " << instance->GetDuration() / 1000.f << "s"; } stream << ')'; @@ -148,17 +150,17 @@ namespace Ndk soundEmitter.BindMethod("IsLooping", &Nz::SoundEmitter::IsLooping); soundEmitter.BindMethod("IsSpatialized", &Nz::SoundEmitter::IsSpatialized); - + soundEmitter.BindMethod("Pause", &Nz::SoundEmitter::Pause); soundEmitter.BindMethod("Play", &Nz::SoundEmitter::Play); - + soundEmitter.BindMethod("SetAttenuation", &Nz::SoundEmitter::SetAttenuation); soundEmitter.BindMethod("SetMinDistance", &Nz::SoundEmitter::SetMinDistance); soundEmitter.BindMethod("SetPitch", &Nz::SoundEmitter::SetPitch); soundEmitter.BindMethod("SetPosition", (void(Nz::SoundEmitter::*)(const Nz::Vector3f&)) &Nz::SoundEmitter::SetPosition); soundEmitter.BindMethod("SetVelocity", (void(Nz::SoundEmitter::*)(const Nz::Vector3f&)) &Nz::SoundEmitter::SetVelocity); soundEmitter.BindMethod("SetVolume", &Nz::SoundEmitter::SetVolume); - + soundEmitter.BindMethod("Stop", &Nz::SoundEmitter::Stop); } diff --git a/SDK/src/NDK/LuaBinding_Math.cpp b/SDK/src/NDK/LuaBinding_Math.cpp index cf5454450..7db9ae9e2 100644 --- a/SDK/src/NDK/LuaBinding_Math.cpp +++ b/SDK/src/NDK/LuaBinding_Math.cpp @@ -238,9 +238,15 @@ namespace Ndk case 'h': lua.Push(instance.height); return true; + + default: + break; } break; } + + default: + break; } return false; @@ -290,6 +296,9 @@ namespace Ndk } break; } + + default: + break; } return false; @@ -313,7 +322,7 @@ namespace Ndk Nz::PlacementNew(quaternion, *static_cast(lua.ToUserdata(1))); else break; - + return true; } @@ -389,6 +398,9 @@ namespace Ndk case 'z': instance.z = value; return true; + + default: + break; } return false; @@ -455,9 +467,15 @@ namespace Ndk case 'y': lua.Push(instance.y); return true; + + default: + break; } break; } + + default: + break; } return false; @@ -496,9 +514,15 @@ namespace Ndk case 'y': instance.y = value; return true; + + default: + break; } break; } + + default: + break; } return false; @@ -582,9 +606,15 @@ namespace Ndk case 'z': lua.Push(instance.z); return true; + + default: + break; } break; } + + default: + break; } return false; @@ -627,9 +657,15 @@ namespace Ndk case 'z': instance.z = value; return true; + + default: + break; } break; } + + default: + break; } return false; diff --git a/include/Nazara/Core/Algorithm.inl b/include/Nazara/Core/Algorithm.inl index 72b5ee27a..048fae8e9 100644 --- a/include/Nazara/Core/Algorithm.inl +++ b/include/Nazara/Core/Algorithm.inl @@ -78,7 +78,7 @@ namespace Nz * \param v Object to hash * * \remark a HashAppend specialization for type T is required - * + * * \see ComputeHash */ template @@ -178,7 +178,7 @@ namespace Nz { T reversed = 0; for (std::size_t i = 0; i < sizeof(T); ++i) - reversed |= T(Detail::BitReverseTable256[(integer >> i * 8) & 0xFF]) << sizeof(T) * 8 - (i + 1) * 8; + reversed |= T(Detail::BitReverseTable256[(integer >> i * 8) & 0xFF]) << (sizeof(T) * 8 - (i + 1) * 8); return reversed; } diff --git a/include/Nazara/Core/HandledObject.inl b/include/Nazara/Core/HandledObject.inl index 738a5f7a5..da435302e 100644 --- a/include/Nazara/Core/HandledObject.inl +++ b/include/Nazara/Core/HandledObject.inl @@ -13,6 +13,7 @@ namespace Nz template HandledObject::HandledObject(const HandledObject& object) { + NazaraUnused(object); // Don't copy anything, we're a copy of the object, we have no handle right now } @@ -40,7 +41,7 @@ namespace Nz HandledObject& HandledObject::operator=(const HandledObject& object) { // Nothing to do - return *this; + return *this; } template diff --git a/include/Nazara/Graphics/Light.inl b/include/Nazara/Graphics/Light.inl index e877852cb..edff48a66 100644 --- a/include/Nazara/Graphics/Light.inl +++ b/include/Nazara/Graphics/Light.inl @@ -9,9 +9,9 @@ namespace Nz { inline Light::Light(const Light& light) : Renderable(light), + m_color(light.m_color), m_type(light.m_type), m_shadowMapFormat(light.m_shadowMapFormat), - m_color(light.m_color), m_shadowMapSize(light.m_shadowMapSize), m_shadowCastingEnabled(light.m_shadowCastingEnabled), m_shadowMapUpdated(false), diff --git a/include/Nazara/Lua/LuaClass.inl b/include/Nazara/Lua/LuaClass.inl index 710b50416..89487b653 100644 --- a/include/Nazara/Lua/LuaClass.inl +++ b/include/Nazara/Lua/LuaClass.inl @@ -21,6 +21,8 @@ namespace Nz { SetConstructor([] (Nz::LuaInstance& lua, T* instance) { + NazaraUnused(lua); + PlacementNew(instance); return true; }); @@ -132,9 +134,9 @@ namespace Nz lua.SetField(pair.first); // Method name } - m_info->instanceGetters[m_info->name] = [info = m_info] (LuaInstance& lua) + m_info->instanceGetters[m_info->name] = [info = m_info] (LuaInstance& instance) { - return static_cast(lua.CheckUserdata(1, info->name)); + return static_cast(instance.CheckUserdata(1, info->name)); }; } lua.Pop(); // On pop la metatable @@ -391,11 +393,11 @@ namespace Nz if (!lua.IsValid(-1)) { - for (const ParentFunc& getter : info->parentGetters) + for (const ParentFunc& parentGetter : info->parentGetters) { lua.Pop(); //< Pop the last nil value - getter(lua, instance); + parentGetter(lua, instance); if (lua.IsValid(-1)) return; } diff --git a/include/Nazara/Network/IpAddress.inl b/include/Nazara/Network/IpAddress.inl index c11c1879a..3184bd34d 100644 --- a/include/Nazara/Network/IpAddress.inl +++ b/include/Nazara/Network/IpAddress.inl @@ -224,7 +224,7 @@ namespace std // This is SDBM adapted for IP addresses, tested to generate the least collisions possible // (It doesn't mean it cannot be improved though) - std::size_t hash = 0; + std::size_t h = 0; switch (ip.GetProtocol()) { case Nz::NetProtocol_Any: @@ -233,20 +233,20 @@ namespace std case Nz::NetProtocol_IPv4: { - hash = ip.ToUInt32() + (hash << 6) + (hash << 16) - hash; + h = ip.ToUInt32() + (h << 6) + (h << 16) - h; break; } case Nz::NetProtocol_IPv6: { Nz::IpAddress::IPv6 v6 = ip.ToIPv6(); for (std::size_t i = 0; i < v6.size(); i++) - hash = v6[i] + (hash << 6) + (hash << 16) - hash; + h = v6[i] + (h << 6) + (h << 16) - h; break; } } - return ip.GetPort() + (hash << 6) + (hash << 16) - hash; + return ip.GetPort() + (h << 6) + (h << 16) - h; } }; } diff --git a/include/Nazara/Network/TcpClient.hpp b/include/Nazara/Network/TcpClient.hpp index fda4671f9..0fcedcf39 100644 --- a/include/Nazara/Network/TcpClient.hpp +++ b/include/Nazara/Network/TcpClient.hpp @@ -79,8 +79,8 @@ namespace Nz PendingPacket m_pendingPacket; UInt64 m_keepAliveInterval; UInt64 m_keepAliveTime; - bool m_isLowDelayEnabled; bool m_isKeepAliveEnabled; + bool m_isLowDelayEnabled; }; } diff --git a/include/Nazara/Utility/PixelFormat.inl b/include/Nazara/Utility/PixelFormat.inl index 7b05ec8fb..e30701d3d 100644 --- a/include/Nazara/Utility/PixelFormat.inl +++ b/include/Nazara/Utility/PixelFormat.inl @@ -12,29 +12,29 @@ namespace Nz { inline PixelFormatInfo::PixelFormatInfo() : - bitsPerPixel(0), - content(PixelFormatContent_Undefined) + content(PixelFormatContent_Undefined), + bitsPerPixel(0) { } inline PixelFormatInfo::PixelFormatInfo(PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) : - bitsPerPixel(bpp), - content(formatContent), - redType(subType), - greenType(subType), - blueType(subType), - alphaType(subType) - { - } - - inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) : - bitsPerPixel(bpp), content(formatContent), redType(subType), greenType(subType), blueType(subType), alphaType(subType), - name(formatName) + bitsPerPixel(bpp) + { + } + + inline PixelFormatInfo::PixelFormatInfo(const String& formatName, PixelFormatContent formatContent, UInt8 bpp, PixelFormatSubType subType) : + content(formatContent), + redType(subType), + greenType(subType), + blueType(subType), + alphaType(subType), + name(formatName), + bitsPerPixel(bpp) { } diff --git a/src/Nazara/Core/File.cpp b/src/Nazara/Core/File.cpp index 97504b0ee..39e873373 100644 --- a/src/Nazara/Core/File.cpp +++ b/src/Nazara/Core/File.cpp @@ -385,7 +385,7 @@ namespace Nz } /*! - * \brief Sets the position of the cursor + * \brief Sets the position of the cursor * \return true if cursor is successfully positioned * * \param pos Position of the cursor @@ -404,7 +404,7 @@ namespace Nz } /*! - * \brief Sets the position of the cursor + * \brief Sets the position of the cursor * \return true if cursor is successfully positioned * * \param offset Offset according to the cursor begin position @@ -906,5 +906,5 @@ namespace Nz } return true; - }; + } } diff --git a/src/Nazara/Core/ParameterList.cpp b/src/Nazara/Core/ParameterList.cpp index 91426a0b7..371e91b77 100644 --- a/src/Nazara/Core/ParameterList.cpp +++ b/src/Nazara/Core/ParameterList.cpp @@ -94,6 +94,7 @@ namespace Nz break; } + case ParameterType_Color: case ParameterType_Float: case ParameterType_None: case ParameterType_Pointer: @@ -198,6 +199,7 @@ namespace Nz } case ParameterType_Boolean: + case ParameterType_Color: case ParameterType_None: case ParameterType_Pointer: case ParameterType_Userdata: @@ -207,7 +209,7 @@ namespace Nz NazaraError("Parameter value is not representable as a float"); return false; } - + /*! * \brief Gets a parameter as an integer * \return true if the parameter could be represented as an integer @@ -263,6 +265,7 @@ namespace Nz break; } + case ParameterType_Color: case ParameterType_None: case ParameterType_Pointer: case ParameterType_Userdata: @@ -331,6 +334,7 @@ namespace Nz return true; case ParameterType_Boolean: + case ParameterType_Color: case ParameterType_Float: case ParameterType_Integer: case ParameterType_None: @@ -411,7 +415,7 @@ namespace Nz NazaraInternalError("Parameter value is not valid"); return false; } - + /*! * \brief Gets a parameter as an userdata * \return true if the parameter could be represented as a userdata @@ -584,7 +588,7 @@ namespace Nz parameter.type = ParameterType_Integer; parameter.value.intVal = value; } - + /*! * \brief Sets a pointer parameter named `name` * @@ -593,7 +597,7 @@ namespace Nz * \param name Name of the parameter * \param value The pointer value * - * \remark This sets a raw pointer, this class takes no responsibility toward it, + * \remark This sets a raw pointer, this class takes no responsibility toward it, if you wish to destroy the pointed variable along with the parameter list, you should set a userdata */ void ParameterList::SetParameter(const String& name, void* value) @@ -639,6 +643,7 @@ namespace Nz switch (it->second.type) { case ParameterType_Boolean: + case ParameterType_Color: case ParameterType_Float: case ParameterType_Integer: case ParameterType_Pointer: diff --git a/src/Nazara/Graphics/ForwardRenderQueue.cpp b/src/Nazara/Graphics/ForwardRenderQueue.cpp index 683230706..9f0f5d04d 100644 --- a/src/Nazara/Graphics/ForwardRenderQueue.cpp +++ b/src/Nazara/Graphics/ForwardRenderQueue.cpp @@ -524,9 +524,9 @@ namespace Nz Vector3f viewerPos = viewer->GetEyePosition(); Vector3f viewerNormal = viewer->GetForward(); - for (auto& pair : layers) + for (auto& layerPair : layers) { - Layer& layer = pair.second; + Layer& layer = layerPair.second; std::sort(layer.transparentModels.begin(), layer.transparentModels.end(), [&layer, &nearPlane, &viewerNormal] (unsigned int index1, unsigned int index2) { @@ -562,7 +562,7 @@ namespace Nz auto it = layers.find(i); if (it == layers.end()) it = layers.insert(std::make_pair(i, Layer())).first; - + Layer& layer = it->second; layer.clearCount = 0; diff --git a/src/Nazara/Renderer/RenderTexture.cpp b/src/Nazara/Renderer/RenderTexture.cpp index 0ae0d97bf..c6e78df86 100644 --- a/src/Nazara/Renderer/RenderTexture.cpp +++ b/src/Nazara/Renderer/RenderTexture.cpp @@ -57,11 +57,14 @@ namespace Nz case PixelFormatContent_Stencil: return AttachmentPoint_Stencil; + + case PixelFormatContent_Undefined: + break; } NazaraInternalError("Unexpected pixel format content: 0x" + String::Number(info.content, 16)); return AttachmentPoint_Max; - }; + } GLuint lockedPrevious = 0; UInt8 lockedLevel = 0; diff --git a/src/Nazara/Utility/AlgorithmUtility.cpp b/src/Nazara/Utility/AlgorithmUtility.cpp index b23542993..7f4dbaf44 100644 --- a/src/Nazara/Utility/AlgorithmUtility.cpp +++ b/src/Nazara/Utility/AlgorithmUtility.cpp @@ -105,9 +105,9 @@ namespace Nz for (unsigned int i = 0; i < recursionLevel; ++i) { std::size_t triangleCount = triangles.size(); - for (std::size_t i = 0; i < triangleCount; ++i) + for (std::size_t j = 0; j < triangleCount; ++j) { - Vector3ui& triangle = triangles[i]; + Vector3ui& triangle = triangles[j]; unsigned int a = GetMiddleVertex(triangle.x, triangle.y); unsigned int b = GetMiddleVertex(triangle.y, triangle.z);