Browse Source

Rinse and repeat by invoking clang-tidy (v3.9) from CLI directly.
It appears that Clion's modified version of the clang-tidy does not detect and fix all the issues.

Yao Wei Tjong 姚伟忠 8 years ago
parent
commit
29fed24492
100 changed files with 425 additions and 429 deletions
  1. 1 1
      Source/Samples/06_SkeletalAnimation/Mover.h
  2. 3 3
      Source/Samples/Utilities2D/Sample2D.cpp
  3. 3 3
      Source/Samples/Utilities2D/Sample2D.h
  4. 1 1
      Source/Tools/AssetImporter/AssetImporter.cpp
  5. 1 1
      Source/Tools/RampGenerator/RampGenerator.cpp
  6. 1 1
      Source/Tools/SpritePacker/SpritePacker.cpp
  7. 2 2
      Source/Urho3D/AngelScript/APITemplates.h
  8. 2 2
      Source/Urho3D/AngelScript/Addons.cpp
  9. 4 4
      Source/Urho3D/AngelScript/Addons.h
  10. 1 1
      Source/Urho3D/AngelScript/CoreAPI.cpp
  11. 2 2
      Source/Urho3D/AngelScript/GraphicsAPI.cpp
  12. 5 5
      Source/Urho3D/AngelScript/ResourceAPI.cpp
  13. 1 1
      Source/Urho3D/AngelScript/Script.cpp
  14. 16 16
      Source/Urho3D/AngelScript/ScriptFile.cpp
  15. 7 7
      Source/Urho3D/Audio/Audio.cpp
  16. 2 2
      Source/Urho3D/Audio/BufferedSoundStream.cpp
  17. 2 2
      Source/Urho3D/Audio/BufferedSoundStream.h
  18. 1 1
      Source/Urho3D/Audio/Sound.cpp
  19. 7 7
      Source/Urho3D/Audio/SoundSource.cpp
  20. 2 2
      Source/Urho3D/Audio/SoundSource.h
  21. 6 6
      Source/Urho3D/Container/ArrayPtr.h
  22. 2 3
      Source/Urho3D/Container/HashBase.cpp
  23. 1 1
      Source/Urho3D/Container/HashMap.h
  24. 1 1
      Source/Urho3D/Container/HashSet.h
  25. 3 3
      Source/Urho3D/Container/LinkedList.h
  26. 1 1
      Source/Urho3D/Container/List.h
  27. 28 31
      Source/Urho3D/Container/Ptr.h
  28. 1 1
      Source/Urho3D/Container/Str.cpp
  29. 3 3
      Source/Urho3D/Container/Str.h
  30. 3 3
      Source/Urho3D/Container/Vector.h
  31. 2 2
      Source/Urho3D/Container/VectorBase.h
  32. 2 2
      Source/Urho3D/Core/Context.h
  33. 2 2
      Source/Urho3D/Core/ProcessUtils.cpp
  34. 1 1
      Source/Urho3D/Core/StringUtils.h
  35. 1 1
      Source/Urho3D/Core/Variant.cpp
  36. 35 35
      Source/Urho3D/Core/Variant.h
  37. 2 2
      Source/Urho3D/Core/WorkQueue.cpp
  38. 1 1
      Source/Urho3D/Core/WorkQueue.h
  39. 2 2
      Source/Urho3D/Graphics/AnimatedModel.h
  40. 1 1
      Source/Urho3D/Graphics/Animation.h
  41. 1 1
      Source/Urho3D/Graphics/AnimationController.h
  42. 1 1
      Source/Urho3D/Graphics/AnimationState.h
  43. 1 1
      Source/Urho3D/Graphics/Batch.cpp
  44. 3 3
      Source/Urho3D/Graphics/DebugRenderer.cpp
  45. 2 2
      Source/Urho3D/Graphics/Drawable.cpp
  46. 5 5
      Source/Urho3D/Graphics/Geometry.cpp
  47. 3 3
      Source/Urho3D/Graphics/Geometry.h
  48. 9 9
      Source/Urho3D/Graphics/Material.cpp
  49. 1 1
      Source/Urho3D/Graphics/Model.h
  50. 6 9
      Source/Urho3D/Graphics/OcclusionBuffer.cpp
  51. 4 4
      Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp
  52. 6 6
      Source/Urho3D/Graphics/OpenGL/OGLIndexBuffer.cpp
  53. 6 6
      Source/Urho3D/Graphics/OpenGL/OGLVertexBuffer.cpp
  54. 3 3
      Source/Urho3D/Graphics/ParticleEffect.h
  55. 2 2
      Source/Urho3D/Graphics/Renderer.cpp
  56. 4 4
      Source/Urho3D/Graphics/Renderer.h
  57. 1 1
      Source/Urho3D/Graphics/Shader.h
  58. 2 2
      Source/Urho3D/Graphics/Skeleton.h
  59. 6 6
      Source/Urho3D/Graphics/Technique.h
  60. 6 6
      Source/Urho3D/Graphics/Terrain.cpp
  61. 5 3
      Source/Urho3D/Graphics/Texture.h
  62. 14 14
      Source/Urho3D/Graphics/View.cpp
  63. 1 1
      Source/Urho3D/Graphics/Viewport.cpp
  64. 1 1
      Source/Urho3D/Graphics/Viewport.h
  65. 6 6
      Source/Urho3D/IK/IKConstraint.cpp
  66. 1 1
      Source/Urho3D/IK/IKEffector.h
  67. 1 1
      Source/Urho3D/IK/IKSolver.h
  68. 2 2
      Source/Urho3D/IO/File.cpp
  69. 1 1
      Source/Urho3D/IO/FileSystem.cpp
  70. 2 2
      Source/Urho3D/IO/FileSystem.h
  71. 2 2
      Source/Urho3D/IO/NamedPipe.cpp
  72. 7 7
      Source/Urho3D/IO/Serializer.cpp
  73. 1 1
      Source/Urho3D/IO/Serializer.h
  74. 2 2
      Source/Urho3D/Input/Input.cpp
  75. 2 2
      Source/Urho3D/LuaScript/ToluaUtils.h
  76. 3 3
      Source/Urho3D/LuaScript/pkgs/Graphics/AnimatedModel.pkg
  77. 3 3
      Source/Urho3D/LuaScript/pkgs/Graphics/ParticleEffect.pkg
  78. 1 1
      Source/Urho3D/Math/Frustum.h
  79. 11 11
      Source/Urho3D/Math/MathDefs.h
  80. 2 2
      Source/Urho3D/Math/Matrix4.h
  81. 1 1
      Source/Urho3D/Math/Polyhedron.h
  82. 3 3
      Source/Urho3D/Math/Quaternion.cpp
  83. 2 2
      Source/Urho3D/Math/StringHash.h
  84. 1 1
      Source/Urho3D/Navigation/NavBuildData.h
  85. 2 2
      Source/Urho3D/Navigation/NavigationMesh.cpp
  86. 1 1
      Source/Urho3D/Navigation/NavigationMesh.h
  87. 1 1
      Source/Urho3D/Network/Connection.cpp
  88. 2 2
      Source/Urho3D/Network/Network.cpp
  89. 5 4
      Source/Urho3D/Physics/PhysicsWorld.cpp
  90. 3 3
      Source/Urho3D/Physics/PhysicsWorld.h
  91. 1 1
      Source/Urho3D/Physics/RaycastVehicle.cpp
  92. 2 2
      Source/Urho3D/Physics/RigidBody.h
  93. 1 1
      Source/Urho3D/Resource/BackgroundLoader.cpp
  94. 5 5
      Source/Urho3D/Resource/Decompress.cpp
  95. 3 3
      Source/Urho3D/Resource/Decompress.h
  96. 12 12
      Source/Urho3D/Resource/Image.cpp
  97. 9 9
      Source/Urho3D/Resource/JSONValue.h
  98. 3 3
      Source/Urho3D/Resource/PListFile.cpp
  99. 64 64
      Source/Urho3D/Resource/ResourceCache.cpp
  100. 2 2
      Source/Urho3D/Resource/ResourceCache.h

+ 1 - 1
Source/Samples/06_SkeletalAnimation/Mover.h

@@ -36,7 +36,7 @@ public:
     explicit Mover(Context* context);
     explicit Mover(Context* context);
 
 
     /// Set motion parameters: forward movement speed, rotation speed, and movement boundaries.
     /// Set motion parameters: forward movement speed, rotation speed, and movement boundaries.
-    void SetParameters(float moveSpeed, float rotateSpeed, const BoundingBox& bounds);
+    void SetParameters(float moveSpeed, float rotationSpeed, const BoundingBox& bounds);
     /// Handle scene update. Called by LogicComponent base class.
     /// Handle scene update. Called by LogicComponent base class.
     void Update(float timeStep) override;
     void Update(float timeStep) override;
 
 

+ 3 - 3
Source/Samples/Utilities2D/Sample2D.cpp

@@ -385,7 +385,7 @@ PODVector<Vector2> Sample2D::CreatePathFromPoints(TileMapObject2D* object, Vecto
     return path;
     return path;
 }
 }
 
 
-void Sample2D::CreateUIContent(String demoTitle, int remainingLifes, int remainingCoins)
+void Sample2D::CreateUIContent(const String& demoTitle, int remainingLifes, int remainingCoins)
 {
 {
     auto* cache = GetSubsystem<ResourceCache>();
     auto* cache = GetSubsystem<ResourceCache>();
     auto* ui = GetSubsystem<UI>();
     auto* ui = GetSubsystem<UI>();
@@ -499,7 +499,7 @@ void Sample2D::SaveScene(bool initial)
     scene_->SaveXML(saveFile);
     scene_->SaveXML(saveFile);
 }
 }
 
 
-void Sample2D::CreateBackgroundSprite(TileMapInfo2D info, float scale, String texture, bool animate)
+void Sample2D::CreateBackgroundSprite(TileMapInfo2D info, float scale, const String& texture, bool animate)
 {
 {
     auto* cache = GetSubsystem<ResourceCache>();
     auto* cache = GetSubsystem<ResourceCache>();
     Node* node = scene_->CreateChild("Background");
     Node* node = scene_->CreateChild("Background");
@@ -531,7 +531,7 @@ void Sample2D::SpawnEffect(Node* node)
     particleEmitter->SetEffect(cache->GetResource<ParticleEffect2D>("Urho2D/sun.pex"));
     particleEmitter->SetEffect(cache->GetResource<ParticleEffect2D>("Urho2D/sun.pex"));
 }
 }
 
 
-void Sample2D::PlaySoundEffect(String soundName)
+void Sample2D::PlaySoundEffect(const String& soundName)
 {
 {
     auto* cache = GetSubsystem<ResourceCache>();
     auto* cache = GetSubsystem<ResourceCache>();
     auto* source = scene_->CreateComponent<SoundSource>();
     auto* source = scene_->CreateComponent<SoundSource>();

+ 3 - 3
Source/Samples/Utilities2D/Sample2D.h

@@ -95,17 +95,17 @@ public:
     /// Create path from tmx object's points.
     /// Create path from tmx object's points.
     PODVector<Vector2> CreatePathFromPoints(TileMapObject2D* object, Vector2 offset);
     PODVector<Vector2> CreatePathFromPoints(TileMapObject2D* object, Vector2 offset);
     /// Create the UI content.
     /// Create the UI content.
-    void CreateUIContent(String demoTitle, int remainingLifes, int remainingCoins);
+    void CreateUIContent(const String& demoTitle, int remainingLifes, int remainingCoins);
     /// Handle 'EXIT' button released event.
     /// Handle 'EXIT' button released event.
     void HandleExitButton(StringHash eventType, VariantMap& eventData);
     void HandleExitButton(StringHash eventType, VariantMap& eventData);
     /// Save the scene.
     /// Save the scene.
     void SaveScene(bool initial);
     void SaveScene(bool initial);
     /// Create a background 2D sprite, optionally rotated by a ValueAnimation object.
     /// Create a background 2D sprite, optionally rotated by a ValueAnimation object.
-    void CreateBackgroundSprite(TileMapInfo2D info, float scale, String texture, bool animate);
+    void CreateBackgroundSprite(TileMapInfo2D info, float scale, const String& texture, bool animate);
     /// Create a particle emitter attached to the given node.
     /// Create a particle emitter attached to the given node.
     void SpawnEffect(Node* node);
     void SpawnEffect(Node* node);
     /// Play a non-looping sound effect.
     /// Play a non-looping sound effect.
-    void PlaySoundEffect(String soundName);
+    void PlaySoundEffect(const String& soundName);
 
 
     /// Filename used in load/save functions.
     /// Filename used in load/save functions.
     String demoFilename_;
     String demoFilename_;

+ 1 - 1
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -2010,7 +2010,7 @@ void CopyTextures(const HashSet<String>& usedTextures, const String& sourcePath)
                     PrintLine("Saving embedded RGBA texture " + GetFileNameAndExtension(fullDestName));
                     PrintLine("Saving embedded RGBA texture " + GetFileNameAndExtension(fullDestName));
                     Image image(context_);
                     Image image(context_);
                     image.SetSize(tex->mWidth, tex->mHeight, 4);
                     image.SetSize(tex->mWidth, tex->mHeight, 4);
-                    memcpy(image.GetData(), (const void*)tex->pcData, tex->mWidth * tex->mHeight * 4);
+                    memcpy(image.GetData(), (const void*)tex->pcData, (size_t)tex->mWidth * tex->mHeight * 4);
                     image.SavePNG(fullDestName);
                     image.SavePNG(fullDestName);
                 }
                 }
             }
             }

+ 1 - 1
Source/Tools/RampGenerator/RampGenerator.cpp

@@ -337,7 +337,7 @@ void WriteIES(unsigned char* data, unsigned width, unsigned height, PODVector<fl
     // otherwise the space used would fit the light's traits and potentially incude a lot of wasted black space
     // otherwise the space used would fit the light's traits and potentially incude a lot of wasted black space
     const float angularFactor = 90.0f;
     const float angularFactor = 90.0f;
     const float fraction = angularFactor / ((float)width);
     const float fraction = angularFactor / ((float)width);
-    ::memset(data, 0, width * height);
+    ::memset(data, 0, (size_t)width * height);
 
 
     for (unsigned y = 0; y < height; ++y)
     for (unsigned y = 0; y < height; ++y)
     {
     {

+ 1 - 1
Source/Tools/SpritePacker/SpritePacker.cpp

@@ -338,7 +338,7 @@ void Run(Vector<String>& arguments)
     spriteSheetImage.SetSize(packedWidth, packedHeight, 4);
     spriteSheetImage.SetSize(packedWidth, packedHeight, 4);
 
 
     // zero out image
     // zero out image
-    spriteSheetImage.SetData((unsigned char*)calloc(sizeof(unsigned char), packedWidth * packedHeight * 4));
+    spriteSheetImage.SetData((unsigned char*)calloc(sizeof(unsigned char), (size_t)packedWidth * packedHeight * 4));
 
 
     XMLFile xml(context);
     XMLFile xml(context);
     XMLElement root = xml.CreateRoot("TextureAtlas");
     XMLElement root = xml.CreateRoot("TextureAtlas");

+ 2 - 2
Source/Urho3D/AngelScript/APITemplates.h

@@ -57,7 +57,7 @@ class Camera;
 template <class T, class U> U* RefCast(T* t)
 template <class T, class U> U* RefCast(T* t)
 {
 {
     if (!t)
     if (!t)
-        return 0;
+        return nullptr;
 
 
     return dynamic_cast<U*>(t);
     return dynamic_cast<U*>(t);
 }
 }
@@ -833,7 +833,7 @@ template <class T> void RegisterResource(asIScriptEngine* engine, const char* cl
     RegisterObject<T>(engine, className);
     RegisterObject<T>(engine, className);
     RegisterSubclass<Resource, T>(engine, "Resource", className);
     RegisterSubclass<Resource, T>(engine, "Resource", className);
     // Do not register factory for the base class
     // Do not register factory for the base class
-    if (strcmp("Resource", className))
+    if (strcmp("Resource", className) != 0)
     {
     {
         RegisterObjectConstructor<T>(engine, className);
         RegisterObjectConstructor<T>(engine, className);
         RegisterNamedObjectConstructor<T>(engine, className);
         RegisterNamedObjectConstructor<T>(engine, className);

+ 2 - 2
Source/Urho3D/AngelScript/Addons.cpp

@@ -2480,10 +2480,10 @@ static void StringSetUTF8FromLatin1(const String& src, String& str)
     str.SetUTF8FromLatin1(src.CString());
     str.SetUTF8FromLatin1(src.CString());
 }
 }
 
 
-static const unsigned NPOS = String::NPOS; // workaround for GCC
-
 void RegisterString(asIScriptEngine *engine)
 void RegisterString(asIScriptEngine *engine)
 {
 {
+    static const unsigned NPOS = String::NPOS; // workaround for GCC
+
     engine->RegisterGlobalProperty("const uint NPOS", (void*)&NPOS);
     engine->RegisterGlobalProperty("const uint NPOS", (void*)&NPOS);
     engine->RegisterObjectType("String", sizeof(String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
     engine->RegisterObjectType("String", sizeof(String), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK);
     engine->RegisterStringFactory("String", asFUNCTION(StringFactory), asCALL_CDECL);
     engine->RegisterStringFactory("String", asFUNCTION(StringFactory), asCALL_CDECL);

+ 4 - 4
Source/Urho3D/AngelScript/Addons.h

@@ -51,8 +51,8 @@ public:
     // Factory functions
     // Factory functions
     static CScriptArray *Create(asITypeInfo *ot);
     static CScriptArray *Create(asITypeInfo *ot);
     static CScriptArray *Create(asITypeInfo *ot, asUINT length);
     static CScriptArray *Create(asITypeInfo *ot, asUINT length);
-    static CScriptArray *Create(asITypeInfo *ot, asUINT length, void *defaultValue);
-    static CScriptArray *Create(asITypeInfo *ot, void *listBuffer);
+    static CScriptArray *Create(asITypeInfo *ot, asUINT length, void *defVal);
+    static CScriptArray *Create(asITypeInfo *ot, void *initList);
 
 
     // Memory management
     // Memory management
     void AddRef() const;
     void AddRef() const;
@@ -121,11 +121,11 @@ protected:
     mutable bool      gcFlag;
     mutable bool      gcFlag;
     asITypeInfo      *objType;
     asITypeInfo      *objType;
     SArrayBuffer     *buffer;
     SArrayBuffer     *buffer;
-    int               elementSize;
+    size_t            elementSize;
     int               subTypeId;
     int               subTypeId;
 
 
     // Constructors
     // Constructors
-    CScriptArray(asITypeInfo *ot, void *initBuf); // Called from script when initialized with list
+    CScriptArray(asITypeInfo *ot, void *buf); // Called from script when initialized with list
     CScriptArray(asUINT length, asITypeInfo *ot);
     CScriptArray(asUINT length, asITypeInfo *ot);
     CScriptArray(asUINT length, void *defVal, asITypeInfo *ot);
     CScriptArray(asUINT length, void *defVal, asITypeInfo *ot);
     CScriptArray(const CScriptArray &other);
     CScriptArray(const CScriptArray &other);

+ 1 - 1
Source/Urho3D/AngelScript/CoreAPI.cpp

@@ -983,7 +983,7 @@ static void DestructWeakHandle(WeakPtr<RefCounted>* ptr)
     ptr->~WeakPtr<RefCounted>();
     ptr->~WeakPtr<RefCounted>();
 }
 }
 
 
-static void SetGlobalVar(const String& key, Variant value)
+static void SetGlobalVar(const String& key, const Variant& value)
 {
 {
     GetScriptContext()->SetGlobalVar(key, value);
     GetScriptContext()->SetGlobalVar(key, value);
 }
 }

+ 2 - 2
Source/Urho3D/AngelScript/GraphicsAPI.cpp

@@ -1632,7 +1632,7 @@ static void RegisterParticleEffect(asIScriptEngine* engine)
     engine->RegisterObjectMethod("ParticleEffect", "void set_faceCameraMode(FaceCameraMode)", asMETHOD(ParticleEffect, SetFaceCameraMode), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void set_faceCameraMode(FaceCameraMode)", asMETHOD(ParticleEffect, SetFaceCameraMode), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "FaceCameraMode get_faceCameraMode() const", asMETHOD(ParticleEffect, GetFaceCameraMode), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "FaceCameraMode get_faceCameraMode() const", asMETHOD(ParticleEffect, GetFaceCameraMode), asCALL_THISCALL);
 
 
-    engine->RegisterObjectMethod("ParticleEffect", "void AddColorTime(Color&, float)", asMETHOD(ParticleEffect, AddColorTime), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ParticleEffect", "void AddColorTime(const Color&, float)", asMETHOD(ParticleEffect, AddColorTime), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void AddColorFrame(ColorFrame@+)", asMETHOD(ParticleEffect, AddColorFrame), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void AddColorFrame(ColorFrame@+)", asMETHOD(ParticleEffect, AddColorFrame), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void SortColorFrames()", asMETHOD(ParticleEffect, SortColorFrames), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void SortColorFrames()", asMETHOD(ParticleEffect, SortColorFrames), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void RemoveColorFrame(uint)", asMETHOD(ParticleEffect, RemoveColorFrame), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void RemoveColorFrame(uint)", asMETHOD(ParticleEffect, RemoveColorFrame), asCALL_THISCALL);
@@ -1641,7 +1641,7 @@ static void RegisterParticleEffect(asIScriptEngine* engine)
     engine->RegisterObjectMethod("ParticleEffect", "uint get_numColorFrames() const", asMETHOD(ParticleEffect, GetNumColorFrames), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "uint get_numColorFrames() const", asMETHOD(ParticleEffect, GetNumColorFrames), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "ColorFrame@+ GetColorFrame(uint) const", asMETHOD(ParticleEffect, GetColorFrame), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "ColorFrame@+ GetColorFrame(uint) const", asMETHOD(ParticleEffect, GetColorFrame), asCALL_THISCALL);
 
 
-    engine->RegisterObjectMethod("ParticleEffect", "void AddTextureTime(Rect&, float)", asMETHOD(ParticleEffect, AddTextureTime), asCALL_THISCALL);
+    engine->RegisterObjectMethod("ParticleEffect", "void AddTextureTime(const Rect&, float)", asMETHOD(ParticleEffect, AddTextureTime), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void AddTextureFrame(TextureFrame@+)", asMETHOD(ParticleEffect, AddTextureFrame), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void AddTextureFrame(TextureFrame@+)", asMETHOD(ParticleEffect, AddTextureFrame), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void SortTextureFrames()", asMETHOD(ParticleEffect, SortTextureFrames), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void SortTextureFrames()", asMETHOD(ParticleEffect, SortTextureFrames), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void RemoveTextureFrame(uint)", asMETHOD(ParticleEffect, RemoveTextureFrame), asCALL_THISCALL);
     engine->RegisterObjectMethod("ParticleEffect", "void RemoveTextureFrame(uint)", asMETHOD(ParticleEffect, RemoveTextureFrame), asCALL_THISCALL);

+ 5 - 5
Source/Urho3D/AngelScript/ResourceAPI.cpp

@@ -620,10 +620,10 @@ static void RegisterXMLElement(asIScriptEngine* engine)
     engine->RegisterObjectMethod("XPathQuery", "bool SetVariable(const String&in, const XPathResultSet&in)", asMETHODPR(XPathQuery, SetVariable, (const String&, const XPathResultSet&), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "bool SetVariable(const String&in, const XPathResultSet&in)", asMETHODPR(XPathQuery, SetVariable, (const String&, const XPathResultSet&), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "bool SetQuery(const String&, const String& arg1 = String(), bool arg2 = true)", asMETHOD(XPathQuery, SetQuery), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "bool SetQuery(const String&, const String& arg1 = String(), bool arg2 = true)", asMETHOD(XPathQuery, SetQuery), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "void Clear()", asMETHOD(XPathQuery, Clear), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "void Clear()", asMETHOD(XPathQuery, Clear), asCALL_THISCALL);
-    engine->RegisterObjectMethod("XPathQuery", "bool EvaluateToBool(XMLElement)", asMETHOD(XPathQuery, EvaluateToBool), asCALL_THISCALL);
-    engine->RegisterObjectMethod("XPathQuery", "float EvaluateToFloat(XMLElement)", asMETHOD(XPathQuery, EvaluateToFloat), asCALL_THISCALL);
-    engine->RegisterObjectMethod("XPathQuery", "String EvaluateToString(XMLElement)", asMETHOD(XPathQuery, EvaluateToString), asCALL_THISCALL);
-    engine->RegisterObjectMethod("XPathQuery", "XPathResultSet Evaluate(XMLElement)", asMETHOD(XPathQuery, Evaluate), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XPathQuery", "bool EvaluateToBool(const XMLElement&in)", asMETHOD(XPathQuery, EvaluateToBool), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XPathQuery", "float EvaluateToFloat(const XMLElement&in)", asMETHOD(XPathQuery, EvaluateToFloat), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XPathQuery", "String EvaluateToString(const XMLElement&in)", asMETHOD(XPathQuery, EvaluateToString), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XPathQuery", "XPathResultSet Evaluate(const XMLElement&in)", asMETHOD(XPathQuery, Evaluate), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "void set_query(const String&)", asMETHOD(XPathQuery, SetQuery), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "void set_query(const String&)", asMETHOD(XPathQuery, SetQuery), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "String get_query() const", asMETHOD(XPathQuery, GetQuery), asCALL_THISCALL);
     engine->RegisterObjectMethod("XPathQuery", "String get_query() const", asMETHOD(XPathQuery, GetQuery), asCALL_THISCALL);
 }
 }
@@ -648,7 +648,7 @@ static void RegisterXMLFile(asIScriptEngine* engine)
     engine->RegisterObjectMethod("XMLFile", "String ToString(const String&in = String(\"\t\")) const", asMETHOD(XMLFile, ToString), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLFile", "String ToString(const String&in = String(\"\t\")) const", asMETHOD(XMLFile, ToString), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLFile", "XMLElement get_root()", asFUNCTION(XMLFileGetRootDefault), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("XMLFile", "XMLElement get_root()", asFUNCTION(XMLFileGetRootDefault), asCALL_CDECL_OBJLAST);
     engine->RegisterObjectMethod("XMLFile", "void Patch(XMLFile@+)", asMETHODPR(XMLFile, Patch, (XMLFile*), void), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLFile", "void Patch(XMLFile@+)", asMETHODPR(XMLFile, Patch, (XMLFile*), void), asCALL_THISCALL);
-    engine->RegisterObjectMethod("XMLFile", "void Patch(XMLElement)", asMETHODPR(XMLFile, Patch, (XMLElement), void), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XMLFile", "void Patch(const XMLElement&in)", asMETHODPR(XMLFile, Patch, (const XMLElement&), void), asCALL_THISCALL);
 }
 }
 
 
 void RegisterResourceAPI(asIScriptEngine* engine)
 void RegisterResourceAPI(asIScriptEngine* engine)

+ 1 - 1
Source/Urho3D/AngelScript/Script.cpp

@@ -345,7 +345,7 @@ const char **Script::GetEnumValues(int asTypeID)
             enumValues_[asTypeID][i] = name;
             enumValues_[asTypeID][i] = name;
         }
         }
     }
     }
-    enumValues_[asTypeID][count] = 0;
+    enumValues_[asTypeID][count] = nullptr;
     return enumValues_[asTypeID].Buffer();
     return enumValues_[asTypeID].Buffer();
 }
 }
 
 

+ 16 - 16
Source/Urho3D/AngelScript/ScriptFile.cpp

@@ -486,34 +486,34 @@ bool ScriptFile::SaveByteCode(Serializer& dest)
         return false;
         return false;
 }
 }
 
 
-asIScriptFunction* ScriptFile::GetFunction(const String& declarationIn)
+asIScriptFunction* ScriptFile::GetFunction(const String& declaration)
 {
 {
     if (!compiled_)
     if (!compiled_)
         return nullptr;
         return nullptr;
 
 
-    String declaration = declarationIn.Trimmed();
-    // If not a full declaration, assume void with no parameters
-    if (declaration.Find('(') == String::NPOS)
-        declaration = "void " + declaration + "()";
+    String trimDecl = declaration.Trimmed();
+    // If not a full trimDecl, assume void with no parameters
+    if (trimDecl.Find('(') == String::NPOS)
+        trimDecl = "void " + trimDecl + "()";
 
 
-    HashMap<String, asIScriptFunction*>::ConstIterator i = functions_.Find(declaration);
+    HashMap<String, asIScriptFunction*>::ConstIterator i = functions_.Find(trimDecl);
     if (i != functions_.End())
     if (i != functions_.End())
         return i->second_;
         return i->second_;
 
 
-    asIScriptFunction* function = scriptModule_->GetFunctionByDecl(declaration.CString());
-    functions_[declaration] = function;
+    asIScriptFunction* function = scriptModule_->GetFunctionByDecl(trimDecl.CString());
+    functions_[trimDecl] = function;
     return function;
     return function;
 }
 }
 
 
-asIScriptFunction* ScriptFile::GetMethod(asIScriptObject* object, const String& declarationIn)
+asIScriptFunction* ScriptFile::GetMethod(asIScriptObject* object, const String& declaration)
 {
 {
     if (!compiled_ || !object)
     if (!compiled_ || !object)
         return nullptr;
         return nullptr;
 
 
-    String declaration = declarationIn.Trimmed();
-    // If not a full declaration, assume void with no parameters
-    if (declaration.Find('(') == String::NPOS)
-        declaration = "void " + declaration + "()";
+    String trimDecl = declaration.Trimmed();
+    // If not a full trimDecl, assume void with no parameters
+    if (trimDecl.Find('(') == String::NPOS)
+        trimDecl = "void " + trimDecl + "()";
 
 
     asITypeInfo* type = object->GetObjectType();
     asITypeInfo* type = object->GetObjectType();
     if (!type)
     if (!type)
@@ -522,13 +522,13 @@ asIScriptFunction* ScriptFile::GetMethod(asIScriptObject* object, const String&
     HashMap<asITypeInfo*, HashMap<String, asIScriptFunction*> >::ConstIterator i = methods_.Find(type);
     HashMap<asITypeInfo*, HashMap<String, asIScriptFunction*> >::ConstIterator i = methods_.Find(type);
     if (i != methods_.End())
     if (i != methods_.End())
     {
     {
-        HashMap<String, asIScriptFunction*>::ConstIterator j = i->second_.Find(declaration);
+        HashMap<String, asIScriptFunction*>::ConstIterator j = i->second_.Find(trimDecl);
         if (j != i->second_.End())
         if (j != i->second_.End())
             return j->second_;
             return j->second_;
     }
     }
 
 
-    asIScriptFunction* function = type->GetMethodByDecl(declaration.CString());
-    methods_[type][declaration] = function;
+    asIScriptFunction* function = type->GetMethodByDecl(trimDecl.CString());
+    methods_[type][trimDecl] = function;
     return function;
     return function;
 }
 }
 
 

+ 7 - 7
Source/Urho3D/Audio/Audio.cpp

@@ -196,11 +196,11 @@ void Audio::SetListener(SoundListener* listener)
     listener_ = listener;
     listener_ = listener;
 }
 }
 
 
-void Audio::StopSound(Sound* soundClip)
+void Audio::StopSound(Sound* sound)
 {
 {
     for (PODVector<SoundSource*>::Iterator i = soundSources_.Begin(); i != soundSources_.End(); ++i)
     for (PODVector<SoundSource*>::Iterator i = soundSources_.Begin(); i != soundSources_.End(); ++i)
     {
     {
-        if ((*i)->GetSound() == soundClip)
+        if ((*i)->GetSound() == sound)
             (*i)->Stop();
             (*i)->Stop();
     }
     }
 }
 }
@@ -225,15 +225,15 @@ SoundListener* Audio::GetListener() const
     return listener_;
     return listener_;
 }
 }
 
 
-void Audio::AddSoundSource(SoundSource* channel)
+void Audio::AddSoundSource(SoundSource* soundSource)
 {
 {
     MutexLock lock(audioMutex_);
     MutexLock lock(audioMutex_);
-    soundSources_.Push(channel);
+    soundSources_.Push(soundSource);
 }
 }
 
 
-void Audio::RemoveSoundSource(SoundSource* channel)
+void Audio::RemoveSoundSource(SoundSource* soundSource)
 {
 {
-    PODVector<SoundSource*>::Iterator i = soundSources_.Find(channel);
+    PODVector<SoundSource*>::Iterator i = soundSources_.Find(soundSource);
     if (i != soundSources_.End())
     if (i != soundSources_.End())
     {
     {
         MutexLock lock(audioMutex_);
         MutexLock lock(audioMutex_);
@@ -269,7 +269,7 @@ void Audio::MixOutput(void* dest, unsigned samples)
 {
 {
     if (!playing_ || !clipBuffer_)
     if (!playing_ || !clipBuffer_)
     {
     {
-        memset(dest, 0, samples * sampleSize_);
+        memset(dest, 0, samples * (size_t)sampleSize_);
         return;
         return;
     }
     }
 
 

+ 2 - 2
Source/Urho3D/Audio/BufferedSoundStream.cpp

@@ -79,7 +79,7 @@ void BufferedSoundStream::AddData(void* data, unsigned numBytes)
     }
     }
 }
 }
 
 
-void BufferedSoundStream::AddData(SharedArrayPtr<signed char> data, unsigned numBytes)
+void BufferedSoundStream::AddData(const SharedArrayPtr<signed char>& data, unsigned numBytes)
 {
 {
     if (data && numBytes)
     if (data && numBytes)
     {
     {
@@ -89,7 +89,7 @@ void BufferedSoundStream::AddData(SharedArrayPtr<signed char> data, unsigned num
     }
     }
 }
 }
 
 
-void BufferedSoundStream::AddData(SharedArrayPtr<signed short> data, unsigned numBytes)
+void BufferedSoundStream::AddData(const SharedArrayPtr<signed short>& data, unsigned numBytes)
 {
 {
     if (data && numBytes)
     if (data && numBytes)
     {
     {

+ 2 - 2
Source/Urho3D/Audio/BufferedSoundStream.h

@@ -46,9 +46,9 @@ public:
     /// Buffer sound data. Makes a copy of it.
     /// Buffer sound data. Makes a copy of it.
     void AddData(void* data, unsigned numBytes);
     void AddData(void* data, unsigned numBytes);
     /// Buffer sound data by taking ownership of it.
     /// Buffer sound data by taking ownership of it.
-    void AddData(SharedArrayPtr<signed char> data, unsigned numBytes);
+    void AddData(const SharedArrayPtr<signed char>& data, unsigned numBytes);
     /// Buffer sound data by taking ownership of it.
     /// Buffer sound data by taking ownership of it.
-    void AddData(SharedArrayPtr<signed short> data, unsigned numBytes);
+    void AddData(const SharedArrayPtr<signed short>& data, unsigned numBytes);
     /// Remove all buffered audio data.
     /// Remove all buffered audio data.
     void Clear();
     void Clear();
 
 

+ 1 - 1
Source/Urho3D/Audio/Sound.cpp

@@ -141,7 +141,7 @@ bool Sound::LoadWav(Deserializer& source)
     header.totalLength_ = source.ReadUInt();
     header.totalLength_ = source.ReadUInt();
     source.Read(&header.waveText_, 4);
     source.Read(&header.waveText_, 4);
 
 
-    if (memcmp("RIFF", header.riffText_, 4) || memcmp("WAVE", header.waveText_, 4))
+    if (memcmp("RIFF", header.riffText_, 4) != 0 || memcmp("WAVE", header.waveText_, 4) != 0)
     {
     {
         URHO3D_LOGERROR("Could not read WAV data from " + source.GetName());
         URHO3D_LOGERROR("Could not read WAV data from " + source.GetName());
         return false;
         return false;

+ 7 - 7
Source/Urho3D/Audio/SoundSource.cpp

@@ -545,7 +545,7 @@ void SoundSource::PlayLockless(Sound* sound)
     sound_.Reset();
     sound_.Reset();
 }
 }
 
 
-void SoundSource::PlayLockless(SharedPtr<SoundStream> stream)
+void SoundSource::PlayLockless(const SharedPtr<SoundStream>& stream)
 {
 {
     // Reset the time position in any case
     // Reset the time position in any case
     timePosition_ = 0.0f;
     timePosition_ = 0.0f;
@@ -605,7 +605,7 @@ void SoundSource::SetPlayPositionLockless(signed char* pos)
 void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 void SoundSource::MixMonoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    auto vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = RoundToInt(256.0f * totalGain);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -759,7 +759,7 @@ void SoundSource::MixMonoToStereo(Sound* sound, int* dest, unsigned samples, int
 void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 void SoundSource::MixMonoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    auto vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = RoundToInt(256.0f * totalGain);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -918,7 +918,7 @@ void SoundSource::MixMonoToStereoIP(Sound* sound, int* dest, unsigned samples, i
 void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    auto vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = RoundToInt(256.0f * totalGain);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -995,7 +995,7 @@ void SoundSource::MixStereoToMono(Sound* sound, int* dest, unsigned samples, int
 void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, int mixRate)
 void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    auto vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = RoundToInt(256.0f * totalGain);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -1076,7 +1076,7 @@ void SoundSource::MixStereoToStereo(Sound* sound, int* dest, unsigned samples, i
 void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    auto vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = RoundToInt(256.0f * totalGain);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);
@@ -1153,7 +1153,7 @@ void SoundSource::MixStereoToMonoIP(Sound* sound, int* dest, unsigned samples, i
 void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 void SoundSource::MixStereoToStereoIP(Sound* sound, int* dest, unsigned samples, int mixRate)
 {
 {
     float totalGain = masterGain_ * attenuation_ * gain_;
     float totalGain = masterGain_ * attenuation_ * gain_;
-    auto vol = (int)(256.0f * totalGain + 0.5f);
+    auto vol = RoundToInt(256.0f * totalGain);
     if (!vol)
     if (!vol)
     {
     {
         MixZeroVolume(sound, samples, mixRate);
         MixZeroVolume(sound, samples, mixRate);

+ 2 - 2
Source/Urho3D/Audio/SoundSource.h

@@ -151,11 +151,11 @@ private:
     /// Play a sound without locking the audio mutex. Called internally.
     /// Play a sound without locking the audio mutex. Called internally.
     void PlayLockless(Sound* sound);
     void PlayLockless(Sound* sound);
     /// Play a sound stream without locking the audio mutex. Called internally.
     /// Play a sound stream without locking the audio mutex. Called internally.
-    void PlayLockless(SharedPtr<SoundStream> stream);
+    void PlayLockless(const SharedPtr<SoundStream>& stream);
     /// Stop sound without locking the audio mutex. Called internally.
     /// Stop sound without locking the audio mutex. Called internally.
     void StopLockless();
     void StopLockless();
     /// Set new playback position without locking the audio mutex. Called internally.
     /// Set new playback position without locking the audio mutex. Called internally.
-    void SetPlayPositionLockless(signed char* position);
+    void SetPlayPositionLockless(signed char* pos);
     /// Mix mono sample to mono buffer.
     /// Mix mono sample to mono buffer.
     void MixMonoToMono(Sound* sound, int* dest, unsigned samples, int mixRate);
     void MixMonoToMono(Sound* sound, int* dest, unsigned samples, int mixRate);
     /// Mix mono sample to stereo buffer.
     /// Mix mono sample to stereo buffer.

+ 6 - 6
Source/Urho3D/Container/ArrayPtr.h

@@ -36,7 +36,7 @@ template <class T> class SharedArrayPtr
 public:
 public:
     /// Construct a null shared array pointer.
     /// Construct a null shared array pointer.
     SharedArrayPtr() :
     SharedArrayPtr() :
-        ptr_(0),
+        ptr_(nullptr),
         refCount_(nullptr)
         refCount_(nullptr)
     {
     {
     }
     }
@@ -110,7 +110,7 @@ public:
     }
     }
 
 
     /// Subscript the array.
     /// Subscript the array.
-    T& operator [](const int index)
+    T& operator [](int index)
     {
     {
         assert(ptr_);
         assert(ptr_);
         return ptr_[index];
         return ptr_[index];
@@ -126,7 +126,7 @@ public:
     bool operator <(const SharedArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     bool operator <(const SharedArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
 
 
     /// Convert to a raw pointer.
     /// Convert to a raw pointer.
-    operator T*() const { return ptr_; }    // NOLINT
+    operator T*() const { return ptr_; }    // NOLINT(google-explicit-constructor)
 
 
     /// Reset to null and release the array reference.
     /// Reset to null and release the array reference.
     void Reset() { ReleaseRef(); }
     void Reset() { ReleaseRef(); }
@@ -201,8 +201,8 @@ private:
                 delete refCount_;
                 delete refCount_;
         }
         }
 
 
-        ptr_ = 0;
-        refCount_ = 0;
+        ptr_ = nullptr;
+        refCount_ = nullptr;
     }
     }
 
 
     /// Pointer to the array.
     /// Pointer to the array.
@@ -340,7 +340,7 @@ public:
     bool operator <(const WeakArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
     bool operator <(const WeakArrayPtr<T>& rhs) const { return ptr_ < rhs.ptr_; }
 
 
     /// Convert to a raw pointer, null if array is expired.
     /// Convert to a raw pointer, null if array is expired.
-    operator T*() const { return Get(); }       // NOLINT
+    operator T*() const { return Get(); }       // NOLINT(google-explicit-constructor)
 
 
     /// Reset to null and release the weak reference.
     /// Reset to null and release the weak reference.
     void Reset() { ReleaseRef(); }
     void Reset() { ReleaseRef(); }

+ 2 - 3
Source/Urho3D/Container/HashBase.cpp

@@ -29,10 +29,9 @@ namespace Urho3D
 
 
 void HashBase::AllocateBuckets(unsigned size, unsigned numBuckets)
 void HashBase::AllocateBuckets(unsigned size, unsigned numBuckets)
 {
 {
-    if (ptrs_)
-        delete[] ptrs_;
+    delete[] ptrs_;
 
 
-    auto** ptrs = new HashNodeBase* [numBuckets + 2];
+    auto ptrs = new HashNodeBase* [numBuckets + 2];
     auto* data = reinterpret_cast<unsigned*>(ptrs);
     auto* data = reinterpret_cast<unsigned*>(ptrs);
     data[0] = size;
     data[0] = size;
     data[1] = numBuckets;
     data[1] = numBuckets;

+ 1 - 1
Source/Urho3D/Container/HashMap.h

@@ -165,7 +165,7 @@ public:
         }
         }
 
 
         /// Construct from a non-const iterator.
         /// Construct from a non-const iterator.
-        ConstIterator(const Iterator& rhs) :        // NOLINT
+        ConstIterator(const Iterator& rhs) :        // NOLINT(google-explicit-constructor)
             HashIteratorBase(rhs.ptr_)
             HashIteratorBase(rhs.ptr_)
         {
         {
         }
         }

+ 1 - 1
Source/Urho3D/Container/HashSet.h

@@ -122,7 +122,7 @@ public:
         }
         }
 
 
         /// Construct from a non-const iterator.
         /// Construct from a non-const iterator.
-        ConstIterator(const Iterator& rhs) :    // NOLINT
+        ConstIterator(const Iterator& rhs) :    // NOLINT(google-explicit-constructor)
             HashIteratorBase(rhs.ptr_)
             HashIteratorBase(rhs.ptr_)
         {
         {
         }
         }

+ 3 - 3
Source/Urho3D/Container/LinkedList.h

@@ -51,7 +51,7 @@ template <class T> class LinkedList
 public:
 public:
     /// Construct empty.
     /// Construct empty.
     LinkedList() :
     LinkedList() :
-        head_(0)
+        head_(nullptr)
     {
     {
     }
     }
     /// Aggregate initialization constructor.
     /// Aggregate initialization constructor.
@@ -172,10 +172,10 @@ public:
     }
     }
 
 
     /// Return next element, or null if no more elements.
     /// Return next element, or null if no more elements.
-    T* Next(T* element) const { return element ? static_cast<T*>(element->next_) : 0; }
+    T* Next(T* element) const { return element ? static_cast<T*>(element->next_) : nullptr; }
 
 
     /// Return whether is empty.
     /// Return whether is empty.
-    bool Empty() const { return head_ == 0; }
+    bool Empty() const { return head_ == nullptr; }
 
 
 private:
 private:
     /// First element.
     /// First element.

+ 1 - 1
Source/Urho3D/Container/List.h

@@ -116,7 +116,7 @@ public:
         }
         }
 
 
         /// Construct from a non-const iterator.
         /// Construct from a non-const iterator.
-        ConstIterator(const Iterator& rhs) :        // NOLINT
+        ConstIterator(const Iterator& rhs) :        // NOLINT(google-explicit-constructor)
             ListIteratorBase(rhs.ptr_)
             ListIteratorBase(rhs.ptr_)
         {
         {
         }
         }

+ 28 - 31
Source/Urho3D/Container/Ptr.h

@@ -38,13 +38,13 @@ template <class T> class SharedPtr
 public:
 public:
     /// Construct a null shared pointer.
     /// Construct a null shared pointer.
     SharedPtr() noexcept :
     SharedPtr() noexcept :
-        ptr_(0)
+        ptr_(nullptr)
     {
     {
     }
     }
 
 
     /// Construct a null shared pointer.
     /// Construct a null shared pointer.
-    SharedPtr(std::nullptr_t) noexcept :     // NOLINT
-        ptr_(0)
+    SharedPtr(std::nullptr_t) noexcept :     // NOLINT(google-explicit-constructor)
+        ptr_(nullptr)
     {
     {
     }
     }
 
 
@@ -56,7 +56,7 @@ public:
     }
     }
 
 
     /// Copy-construct from another shared pointer allowing implicit upcasting.
     /// Copy-construct from another shared pointer allowing implicit upcasting.
-    template <class U> SharedPtr(const SharedPtr<U>& rhs) noexcept :    // NOLINT
+    template <class U> SharedPtr(const SharedPtr<U>& rhs) noexcept :    // NOLINT(google-explicit-constructor)
         ptr_(rhs.ptr_)
         ptr_(rhs.ptr_)
     {
     {
         AddRef();
         AddRef();
@@ -126,7 +126,7 @@ public:
     }
     }
 
 
     /// Subscript the object if applicable.
     /// Subscript the object if applicable.
-    T& operator [](const int index)
+    T& operator [](int index)
     {
     {
         assert(ptr_);
         assert(ptr_);
         return ptr_[index];
         return ptr_[index];
@@ -142,7 +142,7 @@ public:
     template <class U> bool operator !=(const SharedPtr<U>& rhs) const { return ptr_ != rhs.ptr_; }
     template <class U> bool operator !=(const SharedPtr<U>& rhs) const { return ptr_ != rhs.ptr_; }
 
 
     /// Convert to a raw pointer.
     /// Convert to a raw pointer.
-    operator T*() const { return ptr_; }    // NOLINT
+    operator T*() const { return ptr_; }    // NOLINT(google-explicit-constructor)
 
 
     /// Swap with another SharedPtr.
     /// Swap with another SharedPtr.
     void Swap(SharedPtr& rhs) { Urho3D::Swap(ptr_, rhs.ptr_); }
     void Swap(SharedPtr& rhs) { Urho3D::Swap(ptr_, rhs.ptr_); }
@@ -182,7 +182,7 @@ public:
     bool Null() const { return ptr_ == 0; }
     bool Null() const { return ptr_ == 0; }
 
 
     /// Check if the pointer is not null.
     /// Check if the pointer is not null.
-    bool NotNull() const { return ptr_ != 0; }
+    bool NotNull() const { return ptr_ != nullptr; }
 
 
     /// Return the raw pointer.
     /// Return the raw pointer.
     T* Get() const { return ptr_; }
     T* Get() const { return ptr_; }
@@ -194,7 +194,7 @@ public:
     int WeakRefs() const { return ptr_ ? ptr_->WeakRefs() : 0; }
     int WeakRefs() const { return ptr_ ? ptr_->WeakRefs() : 0; }
 
 
     /// Return pointer to the RefCount structure.
     /// Return pointer to the RefCount structure.
-    RefCount* RefCountPtr() const { return ptr_ ? ptr_->RefCountPtr() : 0; }
+    RefCount* RefCountPtr() const { return ptr_ ? ptr_->RefCountPtr() : nullptr; }
 
 
     /// Return hash value for HashSet & HashMap.
     /// Return hash value for HashSet & HashMap.
     unsigned ToHash() const { return (unsigned)((size_t)ptr_ / sizeof(T)); }
     unsigned ToHash() const { return (unsigned)((size_t)ptr_ / sizeof(T)); }
@@ -215,7 +215,7 @@ private:
         if (ptr_)
         if (ptr_)
         {
         {
             ptr_->ReleaseRef();
             ptr_->ReleaseRef();
-            ptr_ = 0;
+            ptr_ = nullptr;
         }
         }
     }
     }
 
 
@@ -245,14 +245,14 @@ template <class T> class WeakPtr
 public:
 public:
     /// Construct a null weak pointer.
     /// Construct a null weak pointer.
     WeakPtr() noexcept :
     WeakPtr() noexcept :
-        ptr_(0),
+        ptr_(nullptr),
         refCount_(nullptr)
         refCount_(nullptr)
     {
     {
     }
     }
 
 
     /// Construct a null weak pointer.
     /// Construct a null weak pointer.
-    WeakPtr(std::nullptr_t) noexcept :   // NOLINT
-        ptr_(0),
+    WeakPtr(std::nullptr_t) noexcept :   // NOLINT(google-explicit-constructor)
+        ptr_(nullptr),
         refCount_(nullptr)
         refCount_(nullptr)
     {
     {
     }
     }
@@ -266,7 +266,7 @@ public:
     }
     }
 
 
     /// Copy-construct from another weak pointer allowing implicit upcasting.
     /// Copy-construct from another weak pointer allowing implicit upcasting.
-    template <class U> WeakPtr(const WeakPtr<U>& rhs) noexcept :   // NOLINT
+    template <class U> WeakPtr(const WeakPtr<U>& rhs) noexcept :   // NOLINT(google-explicit-constructor)
         ptr_(rhs.ptr_),
         ptr_(rhs.ptr_),
         refCount_(rhs.refCount_)
         refCount_(rhs.refCount_)
     {
     {
@@ -274,7 +274,7 @@ public:
     }
     }
 
 
     /// Construct from a shared pointer.
     /// Construct from a shared pointer.
-    WeakPtr(const SharedPtr<T>& rhs) noexcept : // NOLINT
+    WeakPtr(const SharedPtr<T>& rhs) noexcept : // NOLINT(google-explicit-constructor)
         ptr_(rhs.Get()),
         ptr_(rhs.Get()),
         refCount_(rhs.RefCountPtr())
         refCount_(rhs.RefCountPtr())
     {
     {
@@ -284,7 +284,7 @@ public:
     /// Construct from a raw pointer.
     /// Construct from a raw pointer.
     explicit WeakPtr(T* ptr) noexcept :
     explicit WeakPtr(T* ptr) noexcept :
         ptr_(ptr),
         ptr_(ptr),
-        refCount_(ptr ? ptr->RefCountPtr() : 0)
+        refCount_(ptr ? ptr->RefCountPtr() : nullptr)
     {
     {
         AddRef();
         AddRef();
     }
     }
@@ -340,7 +340,7 @@ public:
     /// Assign from a raw pointer.
     /// Assign from a raw pointer.
     WeakPtr<T>& operator =(T* ptr)
     WeakPtr<T>& operator =(T* ptr)
     {
     {
-        RefCount* refCount = ptr ? ptr->RefCountPtr() : 0;
+        RefCount* refCount = ptr ? ptr->RefCountPtr() : nullptr;
 
 
         if (ptr_ == ptr && refCount_ == refCount)
         if (ptr_ == ptr && refCount_ == refCount)
             return *this;
             return *this;
@@ -365,10 +365,7 @@ public:
     /// Return raw pointer. If expired, return null.
     /// Return raw pointer. If expired, return null.
     T* Get() const
     T* Get() const
     {
     {
-        if (Expired())
-            return 0;
-        else
-            return ptr_;
+        return Expired() ? nullptr : ptr_;
     }
     }
 
 
     /// Point to the object.
     /// Point to the object.
@@ -388,7 +385,7 @@ public:
     }
     }
 
 
     /// Subscript the object if applicable.
     /// Subscript the object if applicable.
-    T& operator [](const int index)
+    T& operator [](int index)
     {
     {
         T* rawPtr = Get();
         T* rawPtr = Get();
         assert(rawPtr);
         assert(rawPtr);
@@ -405,7 +402,7 @@ public:
     template <class U> bool operator <(const WeakPtr<U>& rhs) const { return ptr_ < rhs.ptr_; }
     template <class U> bool operator <(const WeakPtr<U>& rhs) const { return ptr_ < rhs.ptr_; }
 
 
     /// Convert to a raw pointer, null if the object is expired.
     /// Convert to a raw pointer, null if the object is expired.
-    operator T*() const { return Get(); }   // NOLINT
+    operator T*() const { return Get(); }   // NOLINT(google-explicit-constructor)
 
 
     /// Reset to null and release the weak reference.
     /// Reset to null and release the weak reference.
     void Reset() { ReleaseRef(); }
     void Reset() { ReleaseRef(); }
@@ -435,10 +432,10 @@ public:
     }
     }
 
 
     /// Check if the pointer is null.
     /// Check if the pointer is null.
-    bool Null() const { return refCount_ == 0; }
+    bool Null() const { return refCount_ == nullptr; }
 
 
     /// Check if the pointer is not null.
     /// Check if the pointer is not null.
-    bool NotNull() const { return refCount_ != 0; }
+    bool NotNull() const { return refCount_ != nullptr; }
 
 
     /// Return the object's reference count, or 0 if null pointer or if object has expired.
     /// Return the object's reference count, or 0 if null pointer or if object has expired.
     int Refs() const { return (refCount_ && refCount_->refs_ >= 0) ? refCount_->refs_ : 0; }
     int Refs() const { return (refCount_ && refCount_->refs_ >= 0) ? refCount_->refs_ : 0; }
@@ -486,8 +483,8 @@ private:
                 delete refCount_;
                 delete refCount_;
         }
         }
 
 
-        ptr_ = 0;
-        refCount_ = 0;
+        ptr_ = nullptr;
+        refCount_ = nullptr;
     }
     }
 
 
     /// Pointer to the object.
     /// Pointer to the object.
@@ -526,7 +523,7 @@ template <class T> class UniquePtr
 {
 {
 public:
 public:
     /// Construct empty.
     /// Construct empty.
-    UniquePtr() : ptr_(0) { }
+    UniquePtr() : ptr_(nullptr) { }
 
 
     /// Construct from pointer.
     /// Construct from pointer.
     explicit UniquePtr(T* ptr) : ptr_(ptr) { }
     explicit UniquePtr(T* ptr) : ptr_(ptr) { }
@@ -544,7 +541,7 @@ public:
     }
     }
 
 
     /// Construct empty.
     /// Construct empty.
-    UniquePtr(std::nullptr_t) { }   // NOLINT
+    UniquePtr(std::nullptr_t) { }   // NOLINT(google-explicit-constructor)
 
 
     /// Move-construct from UniquePtr.
     /// Move-construct from UniquePtr.
     UniquePtr(UniquePtr && up) : ptr_(up.Detach()) { }
     UniquePtr(UniquePtr && up) : ptr_(up.Detach()) { }
@@ -583,7 +580,7 @@ public:
     bool operator !=(const UniquePtr<U>& rhs) const { return ptr_ != rhs.ptr_; }
     bool operator !=(const UniquePtr<U>& rhs) const { return ptr_ != rhs.ptr_; }
 
 
     /// Cast pointer to bool.
     /// Cast pointer to bool.
-    operator bool() const { return !!ptr_; }    // NOLINT
+    operator bool() const { return !!ptr_; }    // NOLINT(google-explicit-constructor)
 
 
     /// Swap with another UniquePtr.
     /// Swap with another UniquePtr.
     void Swap(UniquePtr& up) { Urho3D::Swap(ptr_, up.ptr_); }
     void Swap(UniquePtr& up) { Urho3D::Swap(ptr_, up.ptr_); }
@@ -592,7 +589,7 @@ public:
     T* Detach()
     T* Detach()
     {
     {
         T* ptr = ptr_;
         T* ptr = ptr_;
-        ptr_ = 0;
+        ptr_ = nullptr;
         return ptr;
         return ptr;
     }
     }
 
 
@@ -606,7 +603,7 @@ public:
     T* Get() const { return ptr_; }
     T* Get() const { return ptr_; }
 
 
     /// Reset.
     /// Reset.
-    void Reset(T* ptr = 0)
+    void Reset(T* ptr = nullptr)
     {
     {
         CheckedDelete(ptr_);
         CheckedDelete(ptr_);
         ptr_ = ptr;
         ptr_ = ptr;

+ 1 - 1
Source/Urho3D/Container/Str.cpp

@@ -938,7 +938,7 @@ void String::EncodeUTF8(char*& dest, unsigned unicodeChar)
     }
     }
 }
 }
 
 
-#define GET_NEXT_CONTINUATION_BYTE(ptr) *ptr; if ((unsigned char)*ptr < 0x80 || (unsigned char)*ptr >= 0xc0) return '?'; else ++ptr;
+#define GET_NEXT_CONTINUATION_BYTE(ptr) *(ptr); if ((unsigned char)*(ptr) < 0x80 || (unsigned char)*(ptr) >= 0xc0) return '?'; else ++(ptr);
 
 
 unsigned String::DecodeUTF8(const char*& src)
 unsigned String::DecodeUTF8(const char*& src)
 {
 {

+ 3 - 3
Source/Urho3D/Container/Str.h

@@ -61,7 +61,7 @@ public:
     }
     }
 
 
     /// Construct from a C string.
     /// Construct from a C string.
-    String(const char* str) :   // NOLINT
+    String(const char* str) :   // NOLINT(google-explicit-constructor)
         length_(0),
         length_(0),
         capacity_(0),
         capacity_(0),
         buffer_(&endZero)
         buffer_(&endZero)
@@ -70,7 +70,7 @@ public:
     }
     }
 
 
     /// Construct from a C string.
     /// Construct from a C string.
-    String(char* str) :         // NOLINT
+    String(char* str) :         // NOLINT(google-explicit-constructor)
         length_(0),
         length_(0),
         capacity_(0),
         capacity_(0),
         buffer_(&endZero)
         buffer_(&endZero)
@@ -477,7 +477,7 @@ public:
     String& AppendWithFormatArgs(const char* formatString, va_list args);
     String& AppendWithFormatArgs(const char* formatString, va_list args);
 
 
     /// Compare two C strings.
     /// Compare two C strings.
-    static int Compare(const char* str1, const char* str2, bool caseSensitive);
+    static int Compare(const char* lhs, const char* rhs, bool caseSensitive);
 
 
     /// Position for "not found."
     /// Position for "not found."
     static const unsigned NPOS = 0xffffffff;
     static const unsigned NPOS = 0xffffffff;

+ 3 - 3
Source/Urho3D/Container/Vector.h

@@ -345,7 +345,7 @@ public:
     void Clear() { Resize(0); }
     void Clear() { Resize(0); }
 
 
     /// Resize the vector.
     /// Resize the vector.
-    void Resize(unsigned newSize) { Vector<T> tempBuffer; Resize(newSize, 0, tempBuffer); }
+    void Resize(unsigned newSize) { Vector<T> tempBuffer; Resize(newSize, nullptr, tempBuffer); }
 
 
     /// Resize the vector and fill new elements with default value.
     /// Resize the vector and fill new elements with default value.
     void Resize(unsigned newSize, const T& value)
     void Resize(unsigned newSize, const T& value)
@@ -365,7 +365,7 @@ public:
 
 
         if (newCapacity != capacity_)
         if (newCapacity != capacity_)
         {
         {
-            T* newBuffer = 0;
+            T* newBuffer = nullptr;
             capacity_ = newCapacity;
             capacity_ = newCapacity;
 
 
             if (capacity_)
             if (capacity_)
@@ -512,7 +512,7 @@ private:
             pos = size_;
             pos = size_;
         auto length = (unsigned)(end - start);
         auto length = (unsigned)(end - start);
         Vector<T> tempBuffer;
         Vector<T> tempBuffer;
-        Resize(size_ + length, 0, tempBuffer);
+        Resize(size_ + length, nullptr, tempBuffer);
         MoveRange(pos + length, pos, size_ - pos - length);
         MoveRange(pos + length, pos, size_ - pos - length);
 
 
         T* destPtr = Buffer() + pos;
         T* destPtr = Buffer() + pos;

+ 2 - 2
Source/Urho3D/Container/VectorBase.h

@@ -38,7 +38,7 @@ template <class T> struct RandomAccessIterator
 {
 {
     /// Construct.
     /// Construct.
     RandomAccessIterator() :
     RandomAccessIterator() :
-        ptr_(0)
+        ptr_(nullptr)
     {
     {
     }
     }
 
 
@@ -145,7 +145,7 @@ template <class T> struct RandomAccessConstIterator
     }
     }
 
 
     /// Construct from a non-const iterator.
     /// Construct from a non-const iterator.
-    RandomAccessConstIterator(const RandomAccessIterator<T>& rhs) :     // NOLINT
+    RandomAccessConstIterator(const RandomAccessIterator<T>& rhs) :     // NOLINT(google-explicit-constructor)
         ptr_(rhs.ptr_)
         ptr_(rhs.ptr_)
     {
     {
     }
     }

+ 2 - 2
Source/Urho3D/Core/Context.h

@@ -85,7 +85,7 @@ public:
     /// Register a factory for an object type and specify the object category.
     /// Register a factory for an object type and specify the object category.
     void RegisterFactory(ObjectFactory* factory, const char* category);
     void RegisterFactory(ObjectFactory* factory, const char* category);
     /// Register a subsystem.
     /// Register a subsystem.
-    void RegisterSubsystem(Object* subsystem);
+    void RegisterSubsystem(Object* object);
     /// Remove a subsystem.
     /// Remove a subsystem.
     void RemoveSubsystem(StringHash objectType);
     void RemoveSubsystem(StringHash objectType);
     /// Register object attribute.
     /// Register object attribute.
@@ -255,7 +255,7 @@ template <class T> void Context::RegisterFactory(const char* category)
 
 
 template <class T> T* Context::RegisterSubsystem()
 template <class T> T* Context::RegisterSubsystem()
 {
 {
-    T* subsystem = new T(this);
+    auto* subsystem = new T(this);
     RegisterSubsystem(subsystem);
     RegisterSubsystem(subsystem);
     return subsystem;
     return subsystem;
 }
 }

+ 2 - 2
Source/Urho3D/Core/ProcessUtils.cpp

@@ -138,7 +138,7 @@ static void GetCPUData(struct CpuCoreCount* data)
     fp = fopen("/sys/devices/system/cpu/present", "r");
     fp = fopen("/sys/devices/system/cpu/present", "r");
     if (fp)
     if (fp)
     {
     {
-        res = fscanf(fp, "%d-%d", &i, &j);
+        res = fscanf(fp, "%d-%d", &i, &j);                          // NOLINT(cert-err34-c)
         fclose(fp);
         fclose(fp);
 
 
         if (res == 2 && i == 0)
         if (res == 2 && i == 0)
@@ -148,7 +148,7 @@ static void GetCPUData(struct CpuCoreCount* data)
             fp = fopen("/sys/devices/system/cpu/cpu0/topology/thread_siblings_list", "r");
             fp = fopen("/sys/devices/system/cpu/cpu0/topology/thread_siblings_list", "r");
             if (fp)
             if (fp)
             {
             {
-                res = fscanf(fp, "%d,%d,%d,%d", &i, &j, &i, &j);
+                res = fscanf(fp, "%d,%d,%d,%d", &i, &j, &i, &j);    // NOLINT(cert-err34-c)
                 fclose(fp);
                 fclose(fp);
 
 
                 // Having sibling thread(s) indicates the CPU is using HT/SMT technology
                 // Having sibling thread(s) indicates the CPU is using HT/SMT technology

+ 1 - 1
Source/Urho3D/Core/StringUtils.h

@@ -136,7 +136,7 @@ URHO3D_API unsigned ToLower(unsigned ch);
 /// Convert a memory size into a formatted size string, of the style "1.5 Mb".
 /// Convert a memory size into a formatted size string, of the style "1.5 Mb".
 URHO3D_API String GetFileSizeString(unsigned long long memorySize);
 URHO3D_API String GetFileSizeString(unsigned long long memorySize);
 /// Decode a base64-encoded string into buffer.
 /// Decode a base64-encoded string into buffer.
-URHO3D_API PODVector<unsigned char> DecodeBase64(String encoded_string);
+URHO3D_API PODVector<unsigned char> DecodeBase64(String encodedString);
 /// Parse type from a C string.
 /// Parse type from a C string.
 template <class T> T FromString(const char* source);
 template <class T> T FromString(const char* source);
 
 

+ 1 - 1
Source/Urho3D/Core/Variant.cpp

@@ -72,7 +72,7 @@ static const char* typeNames[] =
     nullptr
     nullptr
 };
 };
 
 
-static_assert(sizeof(typeNames) / sizeof(const char*) == MAX_VAR_TYPES + 1, "Variant type name array is out-of-date");
+static_assert(sizeof(typeNames) / sizeof(const char*) == (size_t)MAX_VAR_TYPES + 1, "Variant type name array is out-of-date");
 
 
 Variant& Variant::operator =(const Variant& rhs)
 Variant& Variant::operator =(const Variant& rhs)
 {
 {

+ 35 - 35
Source/Urho3D/Core/Variant.h

@@ -174,7 +174,7 @@ private:
 
 
 public:
 public:
     /// Construct empty.
     /// Construct empty.
-    CustomVariantValue() : typeInfo_(typeid(void)) { }      // NOLINT
+    CustomVariantValue() : typeInfo_(typeid(void)) { }      // NOLINT(modernize-redundant-void-arg)
     /// Destruct.
     /// Destruct.
     virtual ~CustomVariantValue() = default;
     virtual ~CustomVariantValue() = default;
 
 
@@ -309,11 +309,11 @@ union VariantValue
     CustomVariantValue customValueStack_;
     CustomVariantValue customValueStack_;
 
 
     /// Construct uninitialized.
     /// Construct uninitialized.
-    VariantValue() { }      // NOLINT
+    VariantValue() { }      // NOLINT(modernize-use-equals-default)
     /// Non-copyable.
     /// Non-copyable.
     VariantValue(const VariantValue& value) = delete;
     VariantValue(const VariantValue& value) = delete;
     /// Destruct.
     /// Destruct.
-    ~VariantValue() { }     // NOLINT
+    ~VariantValue() { }     // NOLINT(modernize-use-equals-default)
 };
 };
 
 
 static_assert(sizeof(VariantValue) == VARIANT_VALUE_SIZE, "Unexpected size of VariantValue");
 static_assert(sizeof(VariantValue) == VARIANT_VALUE_SIZE, "Unexpected size of VariantValue");
@@ -326,194 +326,194 @@ public:
     Variant() = default;
     Variant() = default;
 
 
     /// Construct from integer.
     /// Construct from integer.
-    Variant(int value)                  // NOLINT
+    Variant(int value)                  // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from 64 bit integer.
     /// Construct from 64 bit integer.
-    Variant(long long value)            // NOLINT
+    Variant(long long value)            // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from unsigned integer.
     /// Construct from unsigned integer.
-    Variant(unsigned value)             // NOLINT
+    Variant(unsigned value)             // NOLINT(google-explicit-constructor)
     {
     {
         *this = (int)value;
         *this = (int)value;
     }
     }
 
 
     /// Construct from unsigned integer.
     /// Construct from unsigned integer.
-    Variant(unsigned long long value)   // NOLINT
+    Variant(unsigned long long value)   // NOLINT(google-explicit-constructor)
     {
     {
         *this = (long long)value;
         *this = (long long)value;
     }
     }
 
 
     /// Construct from a string hash (convert to integer).
     /// Construct from a string hash (convert to integer).
-    Variant(const StringHash& value)    // NOLINT
+    Variant(const StringHash& value)    // NOLINT(google-explicit-constructor)
     {
     {
         *this = (int)value.Value();
         *this = (int)value.Value();
     }
     }
 
 
     /// Construct from a bool.
     /// Construct from a bool.
-    Variant(bool value)                 // NOLINT
+    Variant(bool value)                 // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a float.
     /// Construct from a float.
-    Variant(float value)                // NOLINT
+    Variant(float value)                // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a double.
     /// Construct from a double.
-    Variant(double value)               // NOLINT
+    Variant(double value)               // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a Vector2.
     /// Construct from a Vector2.
-    Variant(const Vector2& value)       // NOLINT
+    Variant(const Vector2& value)       // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a Vector3.
     /// Construct from a Vector3.
-    Variant(const Vector3& value)       // NOLINT
+    Variant(const Vector3& value)       // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a Vector4.
     /// Construct from a Vector4.
-    Variant(const Vector4& value)       // NOLINT
+    Variant(const Vector4& value)       // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a quaternion.
     /// Construct from a quaternion.
-    Variant(const Quaternion& value)    // NOLINT
+    Variant(const Quaternion& value)    // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a color.
     /// Construct from a color.
-    Variant(const Color& value)         // NOLINT
+    Variant(const Color& value)         // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a string.
     /// Construct from a string.
-    Variant(const String& value)        // NOLINT
+    Variant(const String& value)        // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a C string.
     /// Construct from a C string.
-    Variant(const char* value)          // NOLINT
+    Variant(const char* value)          // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a buffer.
     /// Construct from a buffer.
-    Variant(const PODVector<unsigned char>& value)      // NOLINT
+    Variant(const PODVector<unsigned char>& value)      // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a %VectorBuffer and store as a buffer.
     /// Construct from a %VectorBuffer and store as a buffer.
-    Variant(const VectorBuffer& value)  // NOLINT
+    Variant(const VectorBuffer& value)  // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a pointer.
     /// Construct from a pointer.
-    Variant(void* value)                // NOLINT
+    Variant(void* value)                // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a resource reference.
     /// Construct from a resource reference.
-    Variant(const ResourceRef& value)   // NOLINT
+    Variant(const ResourceRef& value)   // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a resource reference list.
     /// Construct from a resource reference list.
-    Variant(const ResourceRefList& value)   // NOLINT
+    Variant(const ResourceRefList& value)   // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a variant vector.
     /// Construct from a variant vector.
-    Variant(const VariantVector& value) // NOLINT
+    Variant(const VariantVector& value) // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a variant map.
     /// Construct from a variant map.
-    Variant(const VariantMap& value)    // NOLINT
+    Variant(const VariantMap& value)    // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a string vector.
     /// Construct from a string vector.
-    Variant(const StringVector& value)  // NOLINT
+    Variant(const StringVector& value)  // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a rect.
     /// Construct from a rect.
-    Variant(const Rect& value)          // NOLINT
+    Variant(const Rect& value)          // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from an integer rect.
     /// Construct from an integer rect.
-    Variant(const IntRect& value)       // NOLINT
+    Variant(const IntRect& value)       // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from an IntVector2.
     /// Construct from an IntVector2.
-    Variant(const IntVector2& value)    // NOLINT
+    Variant(const IntVector2& value)    // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from an IntVector3.
     /// Construct from an IntVector3.
-    Variant(const IntVector3& value)    // NOLINT
+    Variant(const IntVector3& value)    // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a RefCounted pointer. The object will be stored internally in a WeakPtr so that its expiration can be detected safely.
     /// Construct from a RefCounted pointer. The object will be stored internally in a WeakPtr so that its expiration can be detected safely.
-    Variant(RefCounted* value)          // NOLINT
+    Variant(RefCounted* value)          // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a Matrix3.
     /// Construct from a Matrix3.
-    Variant(const Matrix3& value)       // NOLINT
+    Variant(const Matrix3& value)       // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a Matrix3x4.
     /// Construct from a Matrix3x4.
-    Variant(const Matrix3x4& value)     // NOLINT
+    Variant(const Matrix3x4& value)     // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from a Matrix4.
     /// Construct from a Matrix4.
-    Variant(const Matrix4& value)       // NOLINT
+    Variant(const Matrix4& value)       // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }
 
 
     /// Construct from custom value.
     /// Construct from custom value.
     template <class T>
     template <class T>
-    Variant(const CustomVariantValueImpl<T>& value)     // NOLINT
+    Variant(const CustomVariantValueImpl<T>& value)     // NOLINT(google-explicit-constructor)
     {
     {
         *this = value;
         *this = value;
     }
     }

+ 2 - 2
Source/Urho3D/Core/WorkQueue.cpp

@@ -122,7 +122,7 @@ SharedPtr<WorkItem> WorkQueue::GetFreeItem()
     }
     }
 }
 }
 
 
-void WorkQueue::AddWorkItem(SharedPtr<WorkItem> item)
+void WorkQueue::AddWorkItem(const SharedPtr<WorkItem>& item)
 {
 {
     if (!item)
     if (!item)
     {
     {
@@ -407,7 +407,7 @@ void WorkQueue::HandleBeginFrame(StringHash eventType, VariantMap& eventData)
 
 
         HiresTimer timer;
         HiresTimer timer;
 
 
-        while (!queue_.Empty() && timer.GetUSec(false) < maxNonThreadedWorkMs_ * 1000)
+        while (!queue_.Empty() && timer.GetUSec(false) < maxNonThreadedWorkMs_ * 1000LL)
         {
         {
             WorkItem* item = queue_.Front();
             WorkItem* item = queue_.Front();
             queue_.PopFront();
             queue_.PopFront();

+ 1 - 1
Source/Urho3D/Core/WorkQueue.h

@@ -89,7 +89,7 @@ public:
     /// Get pointer to an usable WorkItem from the item pool. Allocate one if no more free items.
     /// Get pointer to an usable WorkItem from the item pool. Allocate one if no more free items.
     SharedPtr<WorkItem> GetFreeItem();
     SharedPtr<WorkItem> GetFreeItem();
     /// Add a work item and resume worker threads.
     /// Add a work item and resume worker threads.
-    void AddWorkItem(SharedPtr<WorkItem> item);
+    void AddWorkItem(const SharedPtr<WorkItem>& item);
     /// Remove a work item before it has started executing. Return true if successfully removed.
     /// Remove a work item before it has started executing. Return true if successfully removed.
     bool RemoveWorkItem(SharedPtr<WorkItem> item);
     bool RemoveWorkItem(SharedPtr<WorkItem> item);
     /// Remove a number of work items before they have started executing. Return the number of items successfully removed.
     /// Remove a number of work items before they have started executing. Return the number of items successfully removed.

+ 2 - 2
Source/Urho3D/Graphics/AnimatedModel.h

@@ -113,7 +113,7 @@ public:
     /// Return animation state by animation name.
     /// Return animation state by animation name.
     AnimationState* GetAnimationState(const String& animationName) const;
     AnimationState* GetAnimationState(const String& animationName) const;
     /// Return animation state by animation name hash.
     /// Return animation state by animation name hash.
-    AnimationState* GetAnimationState(const StringHash animationNameHash) const;
+    AnimationState* GetAnimationState(StringHash animationNameHash) const;
     /// Return animation state by index.
     /// Return animation state by index.
     AnimationState* GetAnimationState(unsigned index) const;
     AnimationState* GetAnimationState(unsigned index) const;
 
 
@@ -196,7 +196,7 @@ private:
     /// Clone geometries for vertex morphing.
     /// Clone geometries for vertex morphing.
     void CloneGeometries();
     void CloneGeometries();
     /// Copy morph vertices.
     /// Copy morph vertices.
-    void CopyMorphVertices(void* dest, void* src, unsigned vertexCount, VertexBuffer* clone, VertexBuffer* original);
+    void CopyMorphVertices(void* destVertexData, void* srcVertexData, unsigned vertexCount, VertexBuffer* destBuffer, VertexBuffer* srcBuffer);
     /// Recalculate animations. Called from Update().
     /// Recalculate animations. Called from Update().
     void UpdateAnimation(const FrameInfo& frame);
     void UpdateAnimation(const FrameInfo& frame);
     /// Recalculate skinning.
     /// Recalculate skinning.

+ 1 - 1
Source/Urho3D/Graphics/Animation.h

@@ -60,7 +60,7 @@ struct URHO3D_API AnimationTrack
     }
     }
 
 
     /// Assign keyframe at index.
     /// Assign keyframe at index.
-    void SetKeyFrame(unsigned index, const AnimationKeyFrame& command);
+    void SetKeyFrame(unsigned index, const AnimationKeyFrame& keyFrame);
     /// Add a keyframe at the end.
     /// Add a keyframe at the end.
     void AddKeyFrame(const AnimationKeyFrame& keyFrame);
     void AddKeyFrame(const AnimationKeyFrame& keyFrame);
     /// Insert a keyframe at index.
     /// Insert a keyframe at index.

+ 1 - 1
Source/Urho3D/Graphics/AnimationController.h

@@ -107,7 +107,7 @@ public:
     /// Stop all animations on a specific layer. Zero fadetime is instant.
     /// Stop all animations on a specific layer. Zero fadetime is instant.
     void StopLayer(unsigned char layer, float fadeOutTime = 0.0f);
     void StopLayer(unsigned char layer, float fadeOutTime = 0.0f);
     /// Stop all animations. Zero fadetime is instant.
     /// Stop all animations. Zero fadetime is instant.
-    void StopAll(float fadeTime = 0.0f);
+    void StopAll(float fadeOutTime = 0.0f);
     /// Fade animation to target weight. Return true on success.
     /// Fade animation to target weight. Return true on success.
     bool Fade(const String& name, float targetWeight, float fadeTime);
     bool Fade(const String& name, float targetWeight, float fadeTime);
     /// Fade other animations on the same layer to target weight. Return true on success.
     /// Fade other animations on the same layer to target weight. Return true on success.

+ 1 - 1
Source/Urho3D/Graphics/AnimationState.h

@@ -77,7 +77,7 @@ public:
     ~AnimationState() override;
     ~AnimationState() override;
 
 
     /// Set start bone. Not supported in node animation mode. Resets any assigned per-bone weights.
     /// Set start bone. Not supported in node animation mode. Resets any assigned per-bone weights.
-    void SetStartBone(Bone* bone);
+    void SetStartBone(Bone* startBone);
     /// Set looping enabled/disabled.
     /// Set looping enabled/disabled.
     void SetLooped(bool looped);
     void SetLooped(bool looped);
     /// Set blending weight.
     /// Set blending weight.

+ 1 - 1
Source/Urho3D/Graphics/Batch.cpp

@@ -85,7 +85,7 @@ void CalculateShadowMatrix(Matrix4& dest, LightBatchQueue* queue, unsigned split
     Camera* shadowCamera = queue->shadowSplits_[split].shadowCamera_;
     Camera* shadowCamera = queue->shadowSplits_[split].shadowCamera_;
     const IntRect& viewport = queue->shadowSplits_[split].shadowViewport_;
     const IntRect& viewport = queue->shadowSplits_[split].shadowViewport_;
 
 
-    Matrix3x4 shadowView(shadowCamera->GetView());
+    const Matrix3x4& shadowView(shadowCamera->GetView());
     Matrix4 shadowProj(shadowCamera->GetGPUProjection());
     Matrix4 shadowProj(shadowCamera->GetGPUProjection());
     Matrix4 texAdjust(Matrix4::IDENTITY);
     Matrix4 texAdjust(Matrix4::IDENTITY);
 
 

+ 3 - 3
Source/Urho3D/Graphics/DebugRenderer.cpp

@@ -261,9 +261,9 @@ void DebugRenderer::AddSphere(const Sphere& sphere, const Color& color, bool dep
 {
 {
     unsigned uintColor = color.ToUInt();
     unsigned uintColor = color.ToUInt();
 
 
-    for (float j = 0; j < 180; j += 45)
+    for (auto j = 0; j < 180; j += 45)
     {
     {
-        for (float i = 0; i < 360; i += 45)
+        for (auto i = 0; i < 360; i += 45)
         {
         {
             Vector3 p1 = sphere.GetPoint(i, j);
             Vector3 p1 = sphere.GetPoint(i, j);
             Vector3 p2 = sphere.GetPoint(i + 45, j);
             Vector3 p2 = sphere.GetPoint(i + 45, j);
@@ -338,7 +338,7 @@ void DebugRenderer::AddCylinder(const Vector3& position, float radius, float hei
     Vector3 heightVec(0, height, 0);
     Vector3 heightVec(0, height, 0);
     Vector3 offsetXVec(radius, 0, 0);
     Vector3 offsetXVec(radius, 0, 0);
     Vector3 offsetZVec(0, 0, radius);
     Vector3 offsetZVec(0, 0, radius);
-    for (float i = 0; i < 360; i += 45)
+    for (auto i = 0; i < 360; i += 45)
     {
     {
         Vector3 p1 = sphere.GetPoint(i, 90);
         Vector3 p1 = sphere.GetPoint(i, 90);
         Vector3 p2 = sphere.GetPoint(i + 45, 90);
         Vector3 p2 = sphere.GetPoint(i + 45, 90);

+ 2 - 2
Source/Urho3D/Graphics/Drawable.cpp

@@ -576,7 +576,7 @@ bool WriteDrawablesToOBJ(PODVector<Drawable*> drawables, File* outputFile, bool
                     {
                     {
                         //16 bit indices
                         //16 bit indices
                         unsigned short indices[3];
                         unsigned short indices[3];
-                        memcpy(indices, indexData + (indexIdx * indexSize), indexSize * 3);
+                        memcpy(indices, indexData + (indexIdx * indexSize), (size_t)indexSize * 3);
                         longIndices[0] = indices[0] - indexOffset;
                         longIndices[0] = indices[0] - indexOffset;
                         longIndices[1] = indices[1] - indexOffset;
                         longIndices[1] = indices[1] - indexOffset;
                         longIndices[2] = indices[2] - indexOffset;
                         longIndices[2] = indices[2] - indexOffset;
@@ -585,7 +585,7 @@ bool WriteDrawablesToOBJ(PODVector<Drawable*> drawables, File* outputFile, bool
                     {
                     {
                         //32 bit indices
                         //32 bit indices
                         unsigned indices[3];
                         unsigned indices[3];
-                        memcpy(indices, indexData + (indexIdx * indexSize), indexSize * 3);
+                        memcpy(indices, indexData + (indexIdx * indexSize), (size_t)indexSize * 3);
                         longIndices[0] = indices[0] - indexOffset;
                         longIndices[0] = indices[0] - indexOffset;
                         longIndices[1] = indices[1] - indexOffset;
                         longIndices[1] = indices[1] - indexOffset;
                         longIndices[2] = indices[2] - indexOffset;
                         longIndices[2] = indices[2] - indexOffset;

+ 5 - 5
Source/Urho3D/Graphics/Geometry.cpp

@@ -117,7 +117,7 @@ bool Geometry::SetDrawRange(PrimitiveType type, unsigned indexStart, unsigned in
     return true;
     return true;
 }
 }
 
 
-bool Geometry::SetDrawRange(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount,
+bool Geometry::SetDrawRange(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned vertexStart, unsigned vertexCount,
     bool checkIllegal)
     bool checkIllegal)
 {
 {
     if (indexBuffer_)
     if (indexBuffer_)
@@ -139,7 +139,7 @@ bool Geometry::SetDrawRange(PrimitiveType type, unsigned indexStart, unsigned in
     primitiveType_ = type;
     primitiveType_ = type;
     indexStart_ = indexStart;
     indexStart_ = indexStart;
     indexCount_ = indexCount;
     indexCount_ = indexCount;
-    vertexStart_ = minVertex;
+    vertexStart_ = vertexStart;
     vertexCount_ = vertexCount;
     vertexCount_ = vertexCount;
 
 
     return true;
     return true;
@@ -153,21 +153,21 @@ void Geometry::SetLodDistance(float distance)
     lodDistance_ = distance;
     lodDistance_ = distance;
 }
 }
 
 
-void Geometry::SetRawVertexData(SharedArrayPtr<unsigned char> data, const PODVector<VertexElement>& elements)
+void Geometry::SetRawVertexData(const SharedArrayPtr<unsigned char>& data, const PODVector<VertexElement>& elements)
 {
 {
     rawVertexData_ = data;
     rawVertexData_ = data;
     rawVertexSize_ = VertexBuffer::GetVertexSize(elements);
     rawVertexSize_ = VertexBuffer::GetVertexSize(elements);
     rawElements_ = elements;
     rawElements_ = elements;
 }
 }
 
 
-void Geometry::SetRawVertexData(SharedArrayPtr<unsigned char> data, unsigned elementMask)
+void Geometry::SetRawVertexData(const SharedArrayPtr<unsigned char>& data, unsigned elementMask)
 {
 {
     rawVertexData_ = data;
     rawVertexData_ = data;
     rawVertexSize_ = VertexBuffer::GetVertexSize(elementMask);
     rawVertexSize_ = VertexBuffer::GetVertexSize(elementMask);
     rawElements_ = VertexBuffer::GetElements(elementMask);
     rawElements_ = VertexBuffer::GetElements(elementMask);
 }
 }
 
 
-void Geometry::SetRawIndexData(SharedArrayPtr<unsigned char> data, unsigned indexSize)
+void Geometry::SetRawIndexData(const SharedArrayPtr<unsigned char>& data, unsigned indexSize)
 {
 {
     rawIndexData_ = data;
     rawIndexData_ = data;
     rawIndexSize_ = indexSize;
     rawIndexSize_ = indexSize;

+ 3 - 3
Source/Urho3D/Graphics/Geometry.h

@@ -59,11 +59,11 @@ public:
     /// Set the LOD distance.
     /// Set the LOD distance.
     void SetLodDistance(float distance);
     void SetLodDistance(float distance);
     /// Override raw vertex data to be returned for CPU-side operations.
     /// Override raw vertex data to be returned for CPU-side operations.
-    void SetRawVertexData(SharedArrayPtr<unsigned char> data, const PODVector<VertexElement>& elements);
+    void SetRawVertexData(const SharedArrayPtr<unsigned char>& data, const PODVector<VertexElement>& elements);
     /// Override raw vertex data to be returned for CPU-side operations using a legacy vertex bitmask.
     /// Override raw vertex data to be returned for CPU-side operations using a legacy vertex bitmask.
-    void SetRawVertexData(SharedArrayPtr<unsigned char> data, unsigned elementMask);
+    void SetRawVertexData(const SharedArrayPtr<unsigned char>& data, unsigned elementMask);
     /// Override raw index data to be returned for CPU-side operations.
     /// Override raw index data to be returned for CPU-side operations.
-    void SetRawIndexData(SharedArrayPtr<unsigned char> data, unsigned indexSize);
+    void SetRawIndexData(const SharedArrayPtr<unsigned char>& data, unsigned indexSize);
     /// Draw.
     /// Draw.
     void Draw(Graphics* graphics);
     void Draw(Graphics* graphics);
 
 

+ 9 - 9
Source/Urho3D/Graphics/Material.cpp

@@ -123,23 +123,23 @@ TextureUnit ParseTextureUnitName(String name)
     return unit;
     return unit;
 }
 }
 
 
-StringHash ParseTextureTypeName(String name)
+StringHash ParseTextureTypeName(const String& name)
 {
 {
-    name = name.ToLower().Trimmed();
+    String lowerCaseName = name.ToLower().Trimmed();
 
 
-    if (name == "texture")
+    if (lowerCaseName == "texture")
         return Texture2D::GetTypeStatic();
         return Texture2D::GetTypeStatic();
-    else if (name == "cubemap")
+    else if (lowerCaseName == "cubemap")
         return TextureCube::GetTypeStatic();
         return TextureCube::GetTypeStatic();
-    else if (name == "texture3d")
+    else if (lowerCaseName == "texture3d")
         return Texture3D::GetTypeStatic();
         return Texture3D::GetTypeStatic();
-    else if (name == "texturearray")
+    else if (lowerCaseName == "texturearray")
         return Texture2DArray::GetTypeStatic();
         return Texture2DArray::GetTypeStatic();
 
 
     return nullptr;
     return nullptr;
 }
 }
 
 
-StringHash ParseTextureTypeXml(ResourceCache* cache, String filename)
+StringHash ParseTextureTypeXml(ResourceCache* cache, const String& filename)
 {
 {
     StringHash type = nullptr;
     StringHash type = nullptr;
     if (!cache)
     if (!cache)
@@ -179,9 +179,9 @@ TechniqueEntry::TechniqueEntry(Technique* tech, unsigned qualityLevel, float lod
 {
 {
 }
 }
 
 
-ShaderParameterAnimationInfo::ShaderParameterAnimationInfo(Material* target, const String& name, ValueAnimation* attributeAnimation,
+ShaderParameterAnimationInfo::ShaderParameterAnimationInfo(Material* material, const String& name, ValueAnimation* attributeAnimation,
     WrapMode wrapMode, float speed) :
     WrapMode wrapMode, float speed) :
-    ValueAnimationInfo(target, attributeAnimation, wrapMode, speed),
+    ValueAnimationInfo(material, attributeAnimation, wrapMode, speed),
     name_(name)
     name_(name)
 {
 {
 }
 }

+ 1 - 1
Source/Urho3D/Graphics/Model.h

@@ -142,7 +142,7 @@ public:
     /// Set skeleton.
     /// Set skeleton.
     void SetSkeleton(const Skeleton& skeleton);
     void SetSkeleton(const Skeleton& skeleton);
     /// Set bone mappings when model has more bones than the skinning shader can handle.
     /// Set bone mappings when model has more bones than the skinning shader can handle.
-    void SetGeometryBoneMappings(const Vector<PODVector<unsigned> >& mappings);
+    void SetGeometryBoneMappings(const Vector<PODVector<unsigned> >& geometryBoneMappings);
     /// Set vertex morphs.
     /// Set vertex morphs.
     void SetMorphs(const Vector<ModelMorph>& morphs);
     void SetMorphs(const Vector<ModelMorph>& morphs);
     /// Clone the model. The geometry data is deep-copied and can be modified in the clone without affecting the original.
     /// Clone the model. The geometry data is deep-copied and can be modified in the clone without affecting the original.

+ 6 - 9
Source/Urho3D/Graphics/OcclusionBuffer.cpp

@@ -385,10 +385,7 @@ bool OcclusionBuffer::IsVisible(const BoundingBox& worldSpaceBox) const
     }
     }
 
 
     // Expand the bounding box 1 pixel in each direction to be conservative and correct rasterization offset
     // Expand the bounding box 1 pixel in each direction to be conservative and correct rasterization offset
-    IntRect rect(
-        (int)(minX - 1.5f), (int)(minY - 1.5f),
-        (int)(maxX + 0.5f), (int)(maxY + 0.5f)
-    );
+    IntRect rect((int)(minX - 1.5f), (int)(minY - 1.5f), RoundToInt(maxX), RoundToInt(maxY));
 
 
     // If the rect is outside, let frustum culling handle
     // If the rect is outside, let frustum culling handle
     if (rect.right_ < 0 || rect.bottom_ < 0)
     if (rect.right_ < 0 || rect.bottom_ < 0)
@@ -407,7 +404,7 @@ bool OcclusionBuffer::IsVisible(const BoundingBox& worldSpaceBox) const
         rect.bottom_ = height_ - 1;
         rect.bottom_ = height_ - 1;
 
 
     // Convert depth to integer and apply final bias
     // Convert depth to integer and apply final bias
-    int z = (int)(minZ + 0.5f) - OCCLUSION_FIXED_BIAS;
+    int z = RoundToInt(minZ) - OCCLUSION_FIXED_BIAS;
 
 
     if (!depthHierarchyDirty_)
     if (!depthHierarchyDirty_)
     {
     {
@@ -804,10 +801,10 @@ struct Edge
         float yPreStep = (float)(topY + 1) - top.y_;
         float yPreStep = (float)(topY + 1) - top.y_;
         float xPreStep = slope * yPreStep;
         float xPreStep = slope * yPreStep;
 
 
-        x_ = (int)((xPreStep + top.x_) * OCCLUSION_X_SCALE + 0.5f);
-        xStep_ = (int)(slope * OCCLUSION_X_SCALE + 0.5f);
-        invZ_ = (int)(top.z_ + xPreStep * gradients.dInvZdX_ + yPreStep * gradients.dInvZdY_ + 0.5f);
-        invZStep_ = (int)(slope * gradients.dInvZdX_ + gradients.dInvZdY_ + 0.5f);
+        x_ = RoundToInt((xPreStep + top.x_) * OCCLUSION_X_SCALE);
+        xStep_ = RoundToInt(slope * OCCLUSION_X_SCALE);
+        invZ_ = RoundToInt(top.z_ + xPreStep * gradients.dInvZdX_ + yPreStep * gradients.dInvZdY_);
+        invZStep_ = RoundToInt(slope * gradients.dInvZdX_ + gradients.dInvZdY_);
     }
     }
 
 
     /// X coordinate.
     /// X coordinate.

+ 4 - 4
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -220,8 +220,8 @@ static void GetGLPrimitiveType(unsigned elementCount, PrimitiveType type, unsign
 const Vector2 Graphics::pixelUVOffset(0.0f, 0.0f);
 const Vector2 Graphics::pixelUVOffset(0.0f, 0.0f);
 bool Graphics::gl3Support = false;
 bool Graphics::gl3Support = false;
 
 
-Graphics::Graphics(Context* context_) :
-    Object(context_),
+Graphics::Graphics(Context* context) :
+    Object(context),
     impl_(new GraphicsImpl()),
     impl_(new GraphicsImpl()),
     window_(nullptr),
     window_(nullptr),
     externalWindow_(nullptr),
     externalWindow_(nullptr),
@@ -2374,12 +2374,12 @@ void Graphics::CleanupShaderPrograms(ShaderVariation* variation)
         impl_->shaderProgram_ = nullptr;
         impl_->shaderProgram_ = nullptr;
 }
 }
 
 
-ConstantBuffer* Graphics::GetOrCreateConstantBuffer(ShaderType /*type*/,  unsigned bindingIndex, unsigned size)
+ConstantBuffer* Graphics::GetOrCreateConstantBuffer(ShaderType /*type*/,  unsigned index, unsigned size)
 {
 {
     // Note: shaderType parameter is not used on OpenGL, instead binding index should already use the PS range
     // Note: shaderType parameter is not used on OpenGL, instead binding index should already use the PS range
     // for PS constant buffers
     // for PS constant buffers
 
 
-    unsigned key = (bindingIndex << 16) | size;
+    unsigned key = (index << 16) | size;
     HashMap<unsigned, SharedPtr<ConstantBuffer> >::Iterator i = impl_->allConstantBuffers_.Find(key);
     HashMap<unsigned, SharedPtr<ConstantBuffer> >::Iterator i = impl_->allConstantBuffers_.Find(key);
     if (i == impl_->allConstantBuffers_.End())
     if (i == impl_->allConstantBuffers_.End())
     {
     {

+ 6 - 6
Source/Urho3D/Graphics/OpenGL/OGLIndexBuffer.cpp

@@ -87,14 +87,14 @@ bool IndexBuffer::SetData(const void* data)
     }
     }
 
 
     if (shadowData_ && data != shadowData_.Get())
     if (shadowData_ && data != shadowData_.Get())
-        memcpy(shadowData_.Get(), data, indexCount_ * indexSize_);
+        memcpy(shadowData_.Get(), data, indexCount_ * (size_t)indexSize_);
 
 
     if (object_.name_)
     if (object_.name_)
     {
     {
         if (!graphics_->IsDeviceLost())
         if (!graphics_->IsDeviceLost())
         {
         {
             graphics_->SetIndexBuffer(this);
             graphics_->SetIndexBuffer(this);
-            glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount_ * indexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+            glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount_ * (size_t)indexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
         }
         }
         else
         else
         {
         {
@@ -134,7 +134,7 @@ bool IndexBuffer::SetDataRange(const void* data, unsigned start, unsigned count,
         return true;
         return true;
 
 
     if (shadowData_ && shadowData_.Get() + start * indexSize_ != data)
     if (shadowData_ && shadowData_.Get() + start * indexSize_ != data)
-        memcpy(shadowData_.Get() + start * indexSize_, data, count * indexSize_);
+        memcpy(shadowData_.Get() + start * indexSize_, data, count * (size_t)indexSize_);
 
 
     if (object_.name_)
     if (object_.name_)
     {
     {
@@ -142,9 +142,9 @@ bool IndexBuffer::SetDataRange(const void* data, unsigned start, unsigned count,
         {
         {
             graphics_->SetIndexBuffer(this);
             graphics_->SetIndexBuffer(this);
             if (!discard || start != 0)
             if (!discard || start != 0)
-                glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, start * indexSize_, count * indexSize_, data);
+                glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, start * (size_t)indexSize_, count * indexSize_, data);
             else
             else
-                glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * indexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+                glBufferData(GL_ELEMENT_ARRAY_BUFFER, count * (size_t)indexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
         }
         }
         else
         else
         {
         {
@@ -245,7 +245,7 @@ bool IndexBuffer::Create()
         }
         }
 
 
         graphics_->SetIndexBuffer(this);
         graphics_->SetIndexBuffer(this);
-        glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount_ * indexSize_, nullptr, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+        glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount_ * (size_t)indexSize_, nullptr, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
     }
     }
 
 
     return true;
     return true;

+ 6 - 6
Source/Urho3D/Graphics/OpenGL/OGLVertexBuffer.cpp

@@ -90,14 +90,14 @@ bool VertexBuffer::SetData(const void* data)
     }
     }
 
 
     if (shadowData_ && data != shadowData_.Get())
     if (shadowData_ && data != shadowData_.Get())
-        memcpy(shadowData_.Get(), data, vertexCount_ * vertexSize_);
+        memcpy(shadowData_.Get(), data, vertexCount_ * (size_t)vertexSize_);
 
 
     if (object_.name_)
     if (object_.name_)
     {
     {
         if (!graphics_->IsDeviceLost())
         if (!graphics_->IsDeviceLost())
         {
         {
             graphics_->SetVBO(object_.name_);
             graphics_->SetVBO(object_.name_);
-            glBufferData(GL_ARRAY_BUFFER, vertexCount_ * vertexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+            glBufferData(GL_ARRAY_BUFFER, vertexCount_ * (size_t)vertexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
         }
         }
         else
         else
         {
         {
@@ -137,7 +137,7 @@ bool VertexBuffer::SetDataRange(const void* data, unsigned start, unsigned count
         return true;
         return true;
 
 
     if (shadowData_ && shadowData_.Get() + start * vertexSize_ != data)
     if (shadowData_ && shadowData_.Get() + start * vertexSize_ != data)
-        memcpy(shadowData_.Get() + start * vertexSize_, data, count * vertexSize_);
+        memcpy(shadowData_.Get() + start * vertexSize_, data, count * (size_t)vertexSize_);
 
 
     if (object_.name_)
     if (object_.name_)
     {
     {
@@ -145,9 +145,9 @@ bool VertexBuffer::SetDataRange(const void* data, unsigned start, unsigned count
         {
         {
             graphics_->SetVBO(object_.name_);
             graphics_->SetVBO(object_.name_);
             if (!discard || start != 0)
             if (!discard || start != 0)
-                glBufferSubData(GL_ARRAY_BUFFER, start * vertexSize_, count * vertexSize_, data);
+                glBufferSubData(GL_ARRAY_BUFFER, start * (size_t)vertexSize_, count * vertexSize_, data);
             else
             else
-                glBufferData(GL_ARRAY_BUFFER, count * vertexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+                glBufferData(GL_ARRAY_BUFFER, count * (size_t)vertexSize_, data, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
         }
         }
         else
         else
         {
         {
@@ -248,7 +248,7 @@ bool VertexBuffer::Create()
         }
         }
 
 
         graphics_->SetVBO(object_.name_);
         graphics_->SetVBO(object_.name_);
-        glBufferData(GL_ARRAY_BUFFER, vertexCount_ * vertexSize_, nullptr, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+        glBufferData(GL_ARRAY_BUFFER, vertexCount_ * (size_t)vertexSize_, nullptr, dynamic_ ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
     }
     }
 
 
     return true;
     return true;

+ 3 - 3
Source/Urho3D/Graphics/ParticleEffect.h

@@ -187,7 +187,7 @@ public:
     void SetFaceCameraMode(FaceCameraMode mode);
     void SetFaceCameraMode(FaceCameraMode mode);
 
 
     /// Add a color frame sorted in the correct position based on time.
     /// Add a color frame sorted in the correct position based on time.
-    void AddColorTime(const Color& color, const float time);
+    void AddColorTime(const Color& color, float time);
     /// Add a color frame sorted in the correct position based on time.
     /// Add a color frame sorted in the correct position based on time.
     void AddColorFrame(const ColorFrame& colorFrame);
     void AddColorFrame(const ColorFrame& colorFrame);
     /// Remove color frame at index
     /// Remove color frame at index
@@ -202,13 +202,13 @@ public:
     void SortColorFrames();
     void SortColorFrames();
 
 
     /// Add a texture frame sorted in the correct position based on time.
     /// Add a texture frame sorted in the correct position based on time.
-    void AddTextureTime(const Rect& uv, const float time);
+    void AddTextureTime(const Rect& uv, float time);
     /// Add a texture frame sorted in the correct position based on time.
     /// Add a texture frame sorted in the correct position based on time.
     void AddTextureFrame(const TextureFrame& textureFrame);
     void AddTextureFrame(const TextureFrame& textureFrame);
     /// Remove texture frame at index
     /// Remove texture frame at index
     void RemoveTextureFrame(unsigned index);
     void RemoveTextureFrame(unsigned index);
     /// Set particle texture animation.
     /// Set particle texture animation.
-    void SetTextureFrames(const Vector<TextureFrame>& animation);
+    void SetTextureFrames(const Vector<TextureFrame>& textureFrames);
     /// Set number of texture animation frames.
     /// Set number of texture animation frames.
     void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
     void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
     /// Set number of texture frames.
     /// Set number of texture frames.

+ 2 - 2
Source/Urho3D/Graphics/Renderer.cpp

@@ -1143,7 +1143,7 @@ OcclusionBuffer* Renderer::GetOcclusionBuffer(Camera* camera)
     }
     }
 
 
     int width = occlusionBufferSize_;
     int width = occlusionBufferSize_;
-    auto height = (int)((float)occlusionBufferSize_ / camera->GetAspectRatio() + 0.5f);
+    auto height = RoundToInt(occlusionBufferSize_ / camera->GetAspectRatio());
 
 
     OcclusionBuffer* buffer = occlusionBuffers_[numOcclusionBuffers_++];
     OcclusionBuffer* buffer = occlusionBuffers_[numOcclusionBuffers_++];
     buffer->SetSize(width, height, threadedOcclusion_);
     buffer->SetSize(width, height, threadedOcclusion_);
@@ -2009,7 +2009,7 @@ void Renderer::BlurShadowMap(View* view, Texture2D* shadowMap, float blurScale)
     graphics_->SetViewport(IntRect(0, 0, shadowMap->GetWidth(), shadowMap->GetHeight()));
     graphics_->SetViewport(IntRect(0, 0, shadowMap->GetWidth(), shadowMap->GetHeight()));
 
 
     // Get shaders
     // Get shaders
-    static const String shaderName("ShadowBlur");
+    static const char* shaderName = "ShadowBlur";
     ShaderVariation* vs = graphics_->GetShader(VS, shaderName);
     ShaderVariation* vs = graphics_->GetShader(VS, shaderName);
     ShaderVariation* ps = graphics_->GetShader(PS, shaderName);
     ShaderVariation* ps = graphics_->GetShader(PS, shaderName);
     graphics_->SetShaders(vs, ps);
     graphics_->SetShaders(vs, ps);

+ 4 - 4
Source/Urho3D/Graphics/Renderer.h

@@ -189,9 +189,9 @@ public:
     /// Set default renderpath.
     /// Set default renderpath.
     void SetDefaultRenderPath(RenderPath* renderPath);
     void SetDefaultRenderPath(RenderPath* renderPath);
     /// Set default renderpath from an XML file.
     /// Set default renderpath from an XML file.
-    void SetDefaultRenderPath(XMLFile* file);
+    void SetDefaultRenderPath(XMLFile* xmlFile);
     /// Set default non-textured material technique.
     /// Set default non-textured material technique.
-    void SetDefaultTechnique(Technique* tech);
+    void SetDefaultTechnique(Technique* technique);
     /// Set HDR rendering on/off.
     /// Set HDR rendering on/off.
     void SetHDRRendering(bool enable);
     void SetHDRRendering(bool enable);
     /// Set specular lighting on/off.
     /// Set specular lighting on/off.
@@ -406,9 +406,9 @@ public:
     /// Allocate a temporary shadow camera and a scene node for it. Is thread-safe.
     /// Allocate a temporary shadow camera and a scene node for it. Is thread-safe.
     Camera* GetShadowCamera();
     Camera* GetShadowCamera();
     /// Mark a view as prepared by the specified culling camera.
     /// Mark a view as prepared by the specified culling camera.
-    void StorePreparedView(View* view, Camera* cullCamera);
+    void StorePreparedView(View* view, Camera* camera);
     /// Return a prepared view if exists for the specified camera. Used to avoid duplicate view preparation CPU work.
     /// Return a prepared view if exists for the specified camera. Used to avoid duplicate view preparation CPU work.
-    View* GetPreparedView(Camera* cullCamera);
+    View* GetPreparedView(Camera* camera);
     /// Choose shaders for a forward rendering batch. The related batch queue is provided in case it has extra shader compilation defines.
     /// Choose shaders for a forward rendering batch. The related batch queue is provided in case it has extra shader compilation defines.
     void SetBatchShaders(Batch& batch, Technique* tech, bool allowShadows, const BatchQueue& queue);
     void SetBatchShaders(Batch& batch, Technique* tech, bool allowShadows, const BatchQueue& queue);
     /// Choose shaders for a deferred light volume batch.
     /// Choose shaders for a deferred light volume batch.

+ 1 - 1
Source/Urho3D/Graphics/Shader.h

@@ -61,7 +61,7 @@ public:
 
 
 private:
 private:
     /// Process source code and include files. Return true if successful.
     /// Process source code and include files. Return true if successful.
-    bool ProcessSource(String& code, Deserializer& file);
+    bool ProcessSource(String& code, Deserializer& source);
     /// Sort the defines and strip extra spaces to prevent creation of unnecessary duplicate shader variations.
     /// Sort the defines and strip extra spaces to prevent creation of unnecessary duplicate shader variations.
     String NormalizeDefines(const String& defines);
     String NormalizeDefines(const String& defines);
     /// Recalculate the memory used by the shader.
     /// Recalculate the memory used by the shader.

+ 2 - 2
Source/Urho3D/Graphics/Skeleton.h

@@ -121,9 +121,9 @@ public:
     /// Return bone by index.
     /// Return bone by index.
     Bone* GetBone(unsigned index);
     Bone* GetBone(unsigned index);
     /// Return bone by name.
     /// Return bone by name.
-    Bone* GetBone(const String& boneName);
+    Bone* GetBone(const String& name);
     /// Return bone by name.
     /// Return bone by name.
-    Bone* GetBone(const char* boneName);
+    Bone* GetBone(const char* name);
     /// Return bone by name hash.
     /// Return bone by name hash.
     Bone* GetBone(const StringHash& boneNameHash);
     Bone* GetBone(const StringHash& boneNameHash);
 
 

+ 6 - 6
Source/Urho3D/Graphics/Technique.h

@@ -43,7 +43,7 @@ class URHO3D_API Pass : public RefCounted
 {
 {
 public:
 public:
     /// Construct.
     /// Construct.
-    explicit Pass(const String& passName);
+    explicit Pass(const String& name);
     /// Destruct.
     /// Destruct.
     ~Pass() override;
     ~Pass() override;
 
 
@@ -205,9 +205,9 @@ public:
     /// Set whether requires desktop level hardware.
     /// Set whether requires desktop level hardware.
     void SetIsDesktop(bool enable);
     void SetIsDesktop(bool enable);
     /// Create a new pass.
     /// Create a new pass.
-    Pass* CreatePass(const String& passName);
+    Pass* CreatePass(const String& name);
     /// Remove a pass.
     /// Remove a pass.
-    void RemovePass(const String& passName);
+    void RemovePass(const String& name);
     /// Reset shader pointers in all passes.
     /// Reset shader pointers in all passes.
     void ReleaseShaders();
     void ReleaseShaders();
     /// Clone the technique. Passes will be deep copied to allow independent modification.
     /// Clone the technique. Passes will be deep copied to allow independent modification.
@@ -223,13 +223,13 @@ public:
     bool HasPass(unsigned passIndex) const { return passIndex < passes_.Size() && passes_[passIndex].Get() != nullptr; }
     bool HasPass(unsigned passIndex) const { return passIndex < passes_.Size() && passes_[passIndex].Get() != nullptr; }
 
 
     /// Return whether has a pass by name. This overload should not be called in time-critical rendering loops; use a pre-acquired pass index instead.
     /// Return whether has a pass by name. This overload should not be called in time-critical rendering loops; use a pre-acquired pass index instead.
-    bool HasPass(const String& passName) const;
+    bool HasPass(const String& name) const;
 
 
     /// Return a pass, or null if not found.
     /// Return a pass, or null if not found.
     Pass* GetPass(unsigned passIndex) const { return passIndex < passes_.Size() ? passes_[passIndex].Get() : nullptr; }
     Pass* GetPass(unsigned passIndex) const { return passIndex < passes_.Size() ? passes_[passIndex].Get() : nullptr; }
 
 
     /// Return a pass by name, or null if not found. This overload should not be called in time-critical rendering loops; use a pre-acquired pass index instead.
     /// Return a pass by name, or null if not found. This overload should not be called in time-critical rendering loops; use a pre-acquired pass index instead.
-    Pass* GetPass(const String& passName) const;
+    Pass* GetPass(const String& name) const;
 
 
     /// Return a pass that is supported for rendering, or null if not found.
     /// Return a pass that is supported for rendering, or null if not found.
     Pass* GetSupportedPass(unsigned passIndex) const
     Pass* GetSupportedPass(unsigned passIndex) const
@@ -239,7 +239,7 @@ public:
     }
     }
 
 
     /// Return a supported pass by name. This overload should not be called in time-critical rendering loops; use a pre-acquired pass index instead.
     /// Return a supported pass by name. This overload should not be called in time-critical rendering loops; use a pre-acquired pass index instead.
-    Pass* GetSupportedPass(const String& passName) const;
+    Pass* GetSupportedPass(const String& name) const;
 
 
     /// Return number of passes.
     /// Return number of passes.
     unsigned GetNumPasses() const;
     unsigned GetNumPasses() const;

+ 6 - 6
Source/Urho3D/Graphics/Terrain.cpp

@@ -625,8 +625,8 @@ IntVector2 Terrain::WorldToHeightMap(const Vector3& worldPosition) const
         return IntVector2::ZERO;
         return IntVector2::ZERO;
 
 
     Vector3 position = node_->GetWorldTransform().Inverse() * worldPosition;
     Vector3 position = node_->GetWorldTransform().Inverse() * worldPosition;
-    auto xPos = (int)((position.x_ - patchWorldOrigin_.x_) / spacing_.x_ + 0.5f);
-    auto zPos = (int)((position.z_ - patchWorldOrigin_.y_) / spacing_.z_ + 0.5f);
+    auto xPos = RoundToInt((position.x_ - patchWorldOrigin_.x_) / spacing_.x_);
+    auto zPos = RoundToInt((position.z_ - patchWorldOrigin_.y_) / spacing_.z_);
     xPos = Clamp(xPos, 0, numVertices_.x_ - 1);
     xPos = Clamp(xPos, 0, numVertices_.x_ - 1);
     zPos = Clamp(zPos, 0, numVertices_.y_ - 1);
     zPos = Clamp(zPos, 0, numVertices_.y_ - 1);
 
 
@@ -639,8 +639,8 @@ Vector3 Terrain::HeightMapToWorld(const IntVector2& pixelPosition) const
         return Vector3::ZERO;
         return Vector3::ZERO;
 
 
     IntVector2 pos(pixelPosition.x_, numVertices_.y_ - 1 - pixelPosition.y_);
     IntVector2 pos(pixelPosition.x_, numVertices_.y_ - 1 - pixelPosition.y_);
-    auto xPos = (float)(pos.x_ * spacing_.x_ + patchWorldOrigin_.x_);
-    auto zPos = (float)(pos.y_ * spacing_.z_ + patchWorldOrigin_.y_);
+    auto xPos = pos.x_ * spacing_.x_ + patchWorldOrigin_.x_;
+    auto zPos = pos.y_ * spacing_.z_ + patchWorldOrigin_.y_;
     Vector3 lPos(xPos, 0.0f, zPos);
     Vector3 lPos(xPos, 0.0f, zPos);
     Vector3 wPos = node_->GetWorldTransform() * lPos;
     Vector3 wPos = node_->GetWorldTransform() * lPos;
     wPos.y_ = GetHeight(wPos);
     wPos.y_ = GetHeight(wPos);
@@ -1438,12 +1438,12 @@ bool Terrain::SetHeightMapInternal(Image* image, bool recreateNow)
     return true;
     return true;
 }
 }
 
 
-void Terrain::HandleHeightMapReloadFinished(StringHash eventType, VariantMap& eventData)
+void Terrain::HandleHeightMapReloadFinished(StringHash /*eventType*/, VariantMap& eventData)
 {
 {
     CreateGeometry();
     CreateGeometry();
 }
 }
 
 
-void Terrain::HandleNeighborTerrainCreated(StringHash eventType, VariantMap& eventData)
+void Terrain::HandleNeighborTerrainCreated(StringHash /*eventType*/, VariantMap& eventData)
 {
 {
     UpdateEdgePatchNeighbors();
     UpdateEdgePatchNeighbors();
 }
 }

+ 5 - 3
Source/Urho3D/Graphics/Texture.h

@@ -38,6 +38,8 @@ class XMLFile;
 /// Base class for texture resources.
 /// Base class for texture resources.
 class URHO3D_API Texture : public ResourceWithMetadata, public GPUObject
 class URHO3D_API Texture : public ResourceWithMetadata, public GPUObject
 {
 {
+    URHO3D_OBJECT(Texture, ResourceWithMetadata);
+
 public:
 public:
     /// Construct.
     /// Construct.
     explicit Texture(Context* context);
     explicit Texture(Context* context);
@@ -51,9 +53,9 @@ public:
      */
      */
     void SetNumLevels(unsigned levels);
     void SetNumLevels(unsigned levels);
     /// Set filtering mode.
     /// Set filtering mode.
-    void SetFilterMode(TextureFilterMode filter);
+    void SetFilterMode(TextureFilterMode mode);
     /// Set addressing mode by texture coordinate.
     /// Set addressing mode by texture coordinate.
-    void SetAddressMode(TextureCoordinate coord, TextureAddressMode address);
+    void SetAddressMode(TextureCoordinate coord, TextureAddressMode mode);
     /// Set texture max. anisotropy level. No effect if not using anisotropic filtering. Value 0 (default) uses the default setting from Renderer.
     /// Set texture max. anisotropy level. No effect if not using anisotropic filtering. Value 0 (default) uses the default setting from Renderer.
     void SetAnisotropy(unsigned level);
     void SetAnisotropy(unsigned level);
     /// Set shadow compare mode. Not used on Direct3D9.
     /// Set shadow compare mode. Not used on Direct3D9.
@@ -143,7 +145,7 @@ public:
     bool GetParametersDirty() const;
     bool GetParametersDirty() const;
 
 
     /// Set additional parameters from an XML file.
     /// Set additional parameters from an XML file.
-    void SetParameters(XMLFile* xml);
+    void SetParameters(XMLFile* file);
     /// Set additional parameters from an XML element.
     /// Set additional parameters from an XML element.
     void SetParameters(const XMLElement& element);
     void SetParameters(const XMLElement& element);
     /// Mark parameters dirty. Called by Graphics.
     /// Mark parameters dirty. Called by Graphics.

+ 14 - 14
Source/Urho3D/Graphics/View.cpp

@@ -55,16 +55,6 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-static const Vector3* directions[] =
-{
-    &Vector3::RIGHT,
-    &Vector3::LEFT,
-    &Vector3::UP,
-    &Vector3::DOWN,
-    &Vector3::FORWARD,
-    &Vector3::BACK
-};
-
 /// %Frustum octree query for shadowcasters.
 /// %Frustum octree query for shadowcasters.
 class ShadowCasterOctreeQuery : public FrustumOctreeQuery
 class ShadowCasterOctreeQuery : public FrustumOctreeQuery
 {
 {
@@ -287,7 +277,7 @@ void SortShadowQueueWork(const WorkItem* item, unsigned threadIndex)
         start->shadowSplits_[i].shadowBatches_.SortFrontToBack();
         start->shadowSplits_[i].shadowBatches_.SortFrontToBack();
 }
 }
 
 
-StringHash ParseTextureTypeXml(ResourceCache* cache, String filename);
+StringHash ParseTextureTypeXml(ResourceCache* cache, const String& filename);
 
 
 View::View(Context* context) :
 View::View(Context* context) :
     Object(context),
     Object(context),
@@ -2101,8 +2091,8 @@ void View::AllocateScreenBuffers()
             height = (float)viewSize_.y_ * height;
             height = (float)viewSize_.y_ * height;
         }
         }
 
 
-        auto intWidth = (int)(width + 0.5f);
-        auto intHeight = (int)(height + 0.5f);
+        auto intWidth = RoundToInt(width);
+        auto intHeight = RoundToInt(height);
 
 
         // If the rendertarget is persistent, key it with a hash derived from the RT name and the view's pointer
         // If the rendertarget is persistent, key it with a hash derived from the RT name and the view's pointer
         renderTargets_[rtInfo.name_] =
         renderTargets_[rtInfo.name_] =
@@ -2142,7 +2132,7 @@ void View::BlitFramebuffer(Texture* source, RenderSurface* destination, bool dep
     graphics_->SetDepthStencil(GetDepthStencil(destination));
     graphics_->SetDepthStencil(GetDepthStencil(destination));
     graphics_->SetViewport(destRect);
     graphics_->SetViewport(destRect);
 
 
-    static const String shaderName("CopyFramebuffer");
+    static const char* shaderName = "CopyFramebuffer";
     graphics_->SetShaders(graphics_->GetShader(VS, shaderName), graphics_->GetShader(PS, shaderName));
     graphics_->SetShaders(graphics_->GetShader(VS, shaderName), graphics_->GetShader(PS, shaderName));
 
 
     SetGBufferShaderParameters(srcSize, srcRect);
     SetGBufferShaderParameters(srcSize, srcRect);
@@ -2591,6 +2581,16 @@ void View::SetupShadowCameras(LightQueryResult& query)
 
 
     case LIGHT_POINT:
     case LIGHT_POINT:
         {
         {
+            static const Vector3* directions[] =
+            {
+                &Vector3::RIGHT,
+                &Vector3::LEFT,
+                &Vector3::UP,
+                &Vector3::DOWN,
+                &Vector3::FORWARD,
+                &Vector3::BACK
+            };
+
             for (unsigned i = 0; i < MAX_CUBEMAP_FACES; ++i)
             for (unsigned i = 0; i < MAX_CUBEMAP_FACES; ++i)
             {
             {
                 Camera* shadowCamera = renderer_->GetShadowCamera();
                 Camera* shadowCamera = renderer_->GetShadowCamera();

+ 1 - 1
Source/Urho3D/Graphics/Viewport.cpp

@@ -54,7 +54,7 @@ Viewport::Viewport(Context* context, Scene* scene, Camera* camera, RenderPath* r
     SetRenderPath(renderPath);
     SetRenderPath(renderPath);
 }
 }
 
 
-Viewport::Viewport(Context* context, Scene* scene, Camera* camera, const IntRect& rect, RenderPath* renderPath) :
+Viewport::Viewport(Context* context, Scene* scene, Camera* camera, const IntRect& rect, RenderPath* renderPath) :   // NOLINT(modernize-pass-by-value)
     Object(context),
     Object(context),
     scene_(scene),
     scene_(scene),
     camera_(camera),
     camera_(camera),

+ 1 - 1
Source/Urho3D/Graphics/Viewport.h

@@ -59,7 +59,7 @@ public:
     /// Set view rectangle. A zero rectangle (0 0 0 0) means to use the rendertarget's full dimensions.
     /// Set view rectangle. A zero rectangle (0 0 0 0) means to use the rendertarget's full dimensions.
     void SetRect(const IntRect& rect);
     void SetRect(const IntRect& rect);
     /// Set rendering path.
     /// Set rendering path.
-    void SetRenderPath(RenderPath* path);
+    void SetRenderPath(RenderPath* renderPath);
     /// Set rendering path from an XML file.
     /// Set rendering path from an XML file.
     void SetRenderPath(XMLFile* file);
     void SetRenderPath(XMLFile* file);
     /// Set whether to render debug geometry. Default true.
     /// Set whether to render debug geometry. Default true.

+ 6 - 6
Source/Urho3D/IK/IKConstraint.cpp

@@ -66,9 +66,9 @@ float IKConstraint::GetStiffness() const
 void IKConstraint::SetStiffness(float stiffness)
 void IKConstraint::SetStiffness(float stiffness)
 {
 {
     stiffness_ = Clamp(stiffness, 0.0f, 1.0f);
     stiffness_ = Clamp(stiffness, 0.0f, 1.0f);
-    if (ikConstraintNode_ != nullptr)
-        /* TODO ikNode_->stiffness = stiffness_; */
-        ;
+    // TODO
+    //if (ikConstraintNode_ != nullptr)
+    //    ikNode_->stiffness = stiffness_;
 }
 }
 
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
@@ -81,9 +81,9 @@ float IKConstraint::GetStretchiness() const
 void IKConstraint::SetStretchiness(float stretchiness)
 void IKConstraint::SetStretchiness(float stretchiness)
 {
 {
     stretchiness_ = Clamp(stretchiness, 0.0f, 1.0f);
     stretchiness_ = Clamp(stretchiness, 0.0f, 1.0f);
-    if (ikConstraintNode_)
-        /* TODO ikNode_->stretchiness = stretchiness_;*/
-        ;
+    // TODO
+    //if (ikConstraintNode_)
+    //   ikNode_->stretchiness = stretchiness_;
 }
 }
 
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------

+ 1 - 1
Source/Urho3D/IK/IKEffector.h

@@ -174,7 +174,7 @@ private:
     /// Intended to be used only by IKSolver
     /// Intended to be used only by IKSolver
     void SetIKSolver(IKSolver* solver);
     void SetIKSolver(IKSolver* solver);
     /// Intended to be used only by IKSolver
     /// Intended to be used only by IKSolver
-    void SetIKEffectorNode(ik_node_t* effector);
+    void SetIKEffectorNode(ik_node_t* effectorNode);
     /// Intended to be used by IKSolver. Copies the positions/rotations of the target node into the effector
     /// Intended to be used by IKSolver. Copies the positions/rotations of the target node into the effector
     void UpdateTargetNodePosition();
     void UpdateTargetNodePosition();
 
 

+ 1 - 1
Source/Urho3D/IK/IKSolver.h

@@ -321,7 +321,7 @@ private:
     /// Subscribe to drawable update finished event here
     /// Subscribe to drawable update finished event here
     void OnSceneSet(Scene* scene) override;
     void OnSceneSet(Scene* scene) override;
     /// Destroys and creates the tree
     /// Destroys and creates the tree
-    void OnNodeSet(Node* scene) override;
+    void OnNodeSet(Node* node) override;
 
 
     /// Creates the ik library node and sets the current rotation/position and user data correctly.
     /// Creates the ik library node and sets the current rotation/position and user data correctly.
     ik_node_t* CreateIKNodeFromUrhoNode(const Node* node);
     ik_node_t* CreateIKNodeFromUrhoNode(const Node* node);

+ 2 - 2
Source/Urho3D/IO/File.cpp

@@ -332,14 +332,14 @@ unsigned File::Write(const void* data, unsigned size)
     // Need to reassign the position due to internal buffering when transitioning from reading to writing
     // Need to reassign the position due to internal buffering when transitioning from reading to writing
     if (writeSyncNeeded_)
     if (writeSyncNeeded_)
     {
     {
-        fseek((FILE*)handle_, position_ + offset_, SEEK_SET);
+        fseek((FILE*)handle_, (long)position_ + offset_, SEEK_SET);
         writeSyncNeeded_ = false;
         writeSyncNeeded_ = false;
     }
     }
 
 
     if (fwrite(data, size, 1, (FILE*)handle_) != 1)
     if (fwrite(data, size, 1, (FILE*)handle_) != 1)
     {
     {
         // Return to the position where the write began
         // Return to the position where the write began
-        fseek((FILE*)handle_, position_ + offset_, SEEK_SET);
+        fseek((FILE*)handle_, (long)position_ + offset_, SEEK_SET);
         URHO3D_LOGERROR("Error while writing to file " + GetName());
         URHO3D_LOGERROR("Error while writing to file " + GetName());
         return 0;
         return 0;
     }
     }

+ 1 - 1
Source/Urho3D/IO/FileSystem.cpp

@@ -182,7 +182,7 @@ int DoSystemRun(const String& fileName, const Vector<String>& arguments)
         argPtrs.Push(fixedFileName.CString());
         argPtrs.Push(fixedFileName.CString());
         for (unsigned i = 0; i < arguments.Size(); ++i)
         for (unsigned i = 0; i < arguments.Size(); ++i)
             argPtrs.Push(arguments[i].CString());
             argPtrs.Push(arguments[i].CString());
-        argPtrs.Push(0);
+        argPtrs.Push(nullptr);
 
 
         execvp(argPtrs[0], (char**)&argPtrs[0]);
         execvp(argPtrs[0], (char**)&argPtrs[0]);
         return -1; // Return -1 if we could not spawn the process
         return -1; // Return -1 if we could not spawn the process

+ 2 - 2
Source/Urho3D/IO/FileSystem.h

@@ -133,7 +133,7 @@ URHO3D_API String GetFileName(const String& fullPath);
 /// Return the extension from a full path, converted to lowercase by default.
 /// Return the extension from a full path, converted to lowercase by default.
 URHO3D_API String GetExtension(const String& fullPath, bool lowercaseExtension = true);
 URHO3D_API String GetExtension(const String& fullPath, bool lowercaseExtension = true);
 /// Return the filename and extension from a full path. The case of the extension is preserved by default, so that the file can be opened in case-sensitive operating systems.
 /// Return the filename and extension from a full path. The case of the extension is preserved by default, so that the file can be opened in case-sensitive operating systems.
-URHO3D_API String GetFileNameAndExtension(const String& fullPath, bool lowercaseExtension = false);
+URHO3D_API String GetFileNameAndExtension(const String& fileName, bool lowercaseExtension = false);
 /// Replace the extension of a file name with another.
 /// Replace the extension of a file name with another.
 URHO3D_API String ReplaceExtension(const String& fullPath, const String& newExtension);
 URHO3D_API String ReplaceExtension(const String& fullPath, const String& newExtension);
 /// Add a slash at the end of the path if missing and convert to internal format (use slashes.)
 /// Add a slash at the end of the path if missing and convert to internal format (use slashes.)
@@ -141,7 +141,7 @@ URHO3D_API String AddTrailingSlash(const String& pathName);
 /// Remove the slash from the end of a path if exists and convert to internal format (use slashes.)
 /// Remove the slash from the end of a path if exists and convert to internal format (use slashes.)
 URHO3D_API String RemoveTrailingSlash(const String& pathName);
 URHO3D_API String RemoveTrailingSlash(const String& pathName);
 /// Return the parent path, or the path itself if not available.
 /// Return the parent path, or the path itself if not available.
-URHO3D_API String GetParentPath(const String& pathName);
+URHO3D_API String GetParentPath(const String& path);
 /// Convert a path to internal format (use slashes.)
 /// Convert a path to internal format (use slashes.)
 URHO3D_API String GetInternalPath(const String& pathName);
 URHO3D_API String GetInternalPath(const String& pathName);
 /// Convert a path to the format required by the operating system.
 /// Convert a path to the format required by the operating system.

+ 2 - 2
Source/Urho3D/IO/NamedPipe.cpp

@@ -205,7 +205,7 @@ bool NamedPipe::IsEof() const
 
 
 static const char* pipePath = "/tmp/";
 static const char* pipePath = "/tmp/";
 
 
-#define SAFE_CLOSE(handle) if (handle != -1) { close(handle); handle = -1; }
+#define SAFE_CLOSE(handle) if ((handle) != -1) { close(handle); (handle) = -1; }
 
 
 bool NamedPipe::Open(const String& pipeName, bool isServer)
 bool NamedPipe::Open(const String& pipeName, bool isServer)
 {
 {
@@ -363,7 +363,7 @@ bool NamedPipe::IsEof() const
     if (readHandle_ != -1)
     if (readHandle_ != -1)
     {
     {
         fd_set set;
         fd_set set;
-        FD_ZERO(&set);      // NOLINT
+        FD_ZERO(&set);      // NOLINT(modernize-use-bool-literals)
         FD_SET(readHandle_, &set);
         FD_SET(readHandle_, &set);
 
 
         struct timeval timeout;
         struct timeval timeout;

+ 7 - 7
Source/Urho3D/IO/Serializer.cpp

@@ -123,9 +123,9 @@ bool Serializer::WritePackedVector3(const Vector3& value, float maxAbsCoord)
     short coords[3];
     short coords[3];
     float v = 32767.0f / maxAbsCoord;
     float v = 32767.0f / maxAbsCoord;
 
 
-    coords[0] = (short)(Clamp(value.x_, -maxAbsCoord, maxAbsCoord) * v + 0.5f);
-    coords[1] = (short)(Clamp(value.y_, -maxAbsCoord, maxAbsCoord) * v + 0.5f);
-    coords[2] = (short)(Clamp(value.z_, -maxAbsCoord, maxAbsCoord) * v + 0.5f);
+    coords[0] = (short)Round(Clamp(value.x_, -maxAbsCoord, maxAbsCoord) * v);
+    coords[1] = (short)Round(Clamp(value.y_, -maxAbsCoord, maxAbsCoord) * v);
+    coords[2] = (short)Round(Clamp(value.z_, -maxAbsCoord, maxAbsCoord) * v);
     return Write(&coords[0], sizeof coords) == sizeof coords;
     return Write(&coords[0], sizeof coords) == sizeof coords;
 }
 }
 
 
@@ -144,10 +144,10 @@ bool Serializer::WritePackedQuaternion(const Quaternion& value)
     short coords[4];
     short coords[4];
     Quaternion norm = value.Normalized();
     Quaternion norm = value.Normalized();
 
 
-    coords[0] = (short)(Clamp(norm.w_, -1.0f, 1.0f) * q + 0.5f);
-    coords[1] = (short)(Clamp(norm.x_, -1.0f, 1.0f) * q + 0.5f);
-    coords[2] = (short)(Clamp(norm.y_, -1.0f, 1.0f) * q + 0.5f);
-    coords[3] = (short)(Clamp(norm.z_, -1.0f, 1.0f) * q + 0.5f);
+    coords[0] = (short)Round(Clamp(norm.w_, -1.0f, 1.0f) * q);
+    coords[1] = (short)Round(Clamp(norm.x_, -1.0f, 1.0f) * q);
+    coords[2] = (short)Round(Clamp(norm.y_, -1.0f, 1.0f) * q);
+    coords[3] = (short)Round(Clamp(norm.z_, -1.0f, 1.0f) * q);
     return Write(&coords[0], sizeof coords) == sizeof coords;
     return Write(&coords[0], sizeof coords) == sizeof coords;
 }
 }
 
 

+ 1 - 1
Source/Urho3D/IO/Serializer.h

@@ -109,7 +109,7 @@ public:
     /// Write a 32-bit StringHash.
     /// Write a 32-bit StringHash.
     bool WriteStringHash(const StringHash& value);
     bool WriteStringHash(const StringHash& value);
     /// Write a buffer, with size encoded as VLE.
     /// Write a buffer, with size encoded as VLE.
-    bool WriteBuffer(const PODVector<unsigned char>& buffer);
+    bool WriteBuffer(const PODVector<unsigned char>& value);
     /// Write a resource reference.
     /// Write a resource reference.
     bool WriteResourceRef(const ResourceRef& value);
     bool WriteResourceRef(const ResourceRef& value);
     /// Write a resource reference list.
     /// Write a resource reference list.

+ 2 - 2
Source/Urho3D/Input/Input.cpp

@@ -2431,8 +2431,8 @@ void Input::HandleScreenJoystickTouch(StringHash eventType, VariantMap& eventDat
             return;
             return;
 
 
         // Determine whether to inject a joystick event or keyboard/mouse event
         // Determine whether to inject a joystick event or keyboard/mouse event
-        Variant keyBindingVar = element->GetVar(VAR_BUTTON_KEY_BINDING);
-        Variant mouseButtonBindingVar = element->GetVar(VAR_BUTTON_MOUSE_BUTTON_BINDING);
+        const Variant& keyBindingVar = element->GetVar(VAR_BUTTON_KEY_BINDING);
+        const Variant& mouseButtonBindingVar = element->GetVar(VAR_BUTTON_MOUSE_BUTTON_BINDING);
         if (keyBindingVar.IsEmpty() && mouseButtonBindingVar.IsEmpty())
         if (keyBindingVar.IsEmpty() && mouseButtonBindingVar.IsEmpty())
         {
         {
             evt.type = eventType == E_TOUCHBEGIN ? SDL_JOYBUTTONDOWN : SDL_JOYBUTTONUP;
             evt.type = eventType == E_TOUCHBEGIN ? SDL_JOYBUTTONDOWN : SDL_JOYBUTTONUP;

+ 2 - 2
Source/Urho3D/LuaScript/ToluaUtils.h

@@ -49,7 +49,7 @@ Context* GetContext(lua_State* L);
 /// Create object.
 /// Create object.
 template <typename T> int ToluaNewObject(lua_State* tolua_S)
 template <typename T> int ToluaNewObject(lua_State* tolua_S)
 {
 {
-    T* object = Mtolua_new(T(GetContext(tolua_S)));
+    auto* object = Mtolua_new(T(GetContext(tolua_S)));
     tolua_pushusertype(tolua_S, (void*)object, T::GetTypeNameStatic().CString());
     tolua_pushusertype(tolua_S, (void*)object, T::GetTypeNameStatic().CString());
     return 1;
     return 1;
 }
 }
@@ -57,7 +57,7 @@ template <typename T> int ToluaNewObject(lua_State* tolua_S)
 /// Create object with garbage collection.
 /// Create object with garbage collection.
 template <typename T> int ToluaNewObjectGC(lua_State* tolua_S)
 template <typename T> int ToluaNewObjectGC(lua_State* tolua_S)
 {
 {
-    T* object = Mtolua_new(T(GetContext(tolua_S)));
+    auto* object = Mtolua_new(T(GetContext(tolua_S)));
     tolua_pushusertype(tolua_S, (void*)object, T::GetTypeNameStatic().CString());
     tolua_pushusertype(tolua_S, (void*)object, T::GetTypeNameStatic().CString());
     tolua_register_gc(tolua_S, lua_gettop(tolua_S));
     tolua_register_gc(tolua_S, lua_gettop(tolua_S));
     return 1;
     return 1;

+ 3 - 3
Source/Urho3D/LuaScript/pkgs/Graphics/AnimatedModel.pkg

@@ -21,7 +21,7 @@ class AnimatedModel : public StaticModel
     unsigned GetNumAnimationStates() const;
     unsigned GetNumAnimationStates() const;
     AnimationState* GetAnimationState(Animation* animation) const;
     AnimationState* GetAnimationState(Animation* animation) const;
     AnimationState* GetAnimationState(const String animationName) const;
     AnimationState* GetAnimationState(const String animationName) const;
-    AnimationState* GetAnimationState(const StringHash animationNameHash) const;
+    AnimationState* GetAnimationState(StringHash animationNameHash) const;
     AnimationState* GetAnimationState(unsigned index) const;
     AnimationState* GetAnimationState(unsigned index) const;
     float GetAnimationLodBias() const;
     float GetAnimationLodBias() const;
     bool GetUpdateInvisible() const;
     bool GetUpdateInvisible() const;
@@ -30,7 +30,7 @@ class AnimatedModel : public StaticModel
     float GetMorphWeight(StringHash nameHash) const;
     float GetMorphWeight(StringHash nameHash) const;
     float GetMorphWeight(unsigned index) const;
     float GetMorphWeight(unsigned index) const;
     bool IsMaster() const;
     bool IsMaster() const;
-    
+
     void UpdateBoneBoundingBox();
     void UpdateBoneBoundingBox();
 
 
     tolua_property__get_set Model* model;
     tolua_property__get_set Model* model;
@@ -40,4 +40,4 @@ class AnimatedModel : public StaticModel
     tolua_property__get_set bool updateInvisible;
     tolua_property__get_set bool updateInvisible;
     tolua_readonly tolua_property__get_set unsigned numMorphs;
     tolua_readonly tolua_property__get_set unsigned numMorphs;
     tolua_readonly tolua_property__is_set bool master;
     tolua_readonly tolua_property__is_set bool master;
-};
+};

+ 3 - 3
Source/Urho3D/LuaScript/pkgs/Graphics/ParticleEffect.pkg

@@ -62,19 +62,19 @@ class ParticleEffect : public Resource
     void SetMaxRotationSpeed(float speed);
     void SetMaxRotationSpeed(float speed);
     void SetSizeAdd(float sizeAdd);
     void SetSizeAdd(float sizeAdd);
     void SetSizeMul(float sizeMul);
     void SetSizeMul(float sizeMul);
-    void AddColorTime(const Color& color, const float time);
+    void AddColorTime(const Color& color, float time);
     void AddColorFrame(const ColorFrame& colorFrame);
     void AddColorFrame(const ColorFrame& colorFrame);
     void RemoveColorFrame(unsigned index);
     void RemoveColorFrame(unsigned index);
     void SetColorFrame(unsigned index, const ColorFrame& colorFrame);
     void SetColorFrame(unsigned index, const ColorFrame& colorFrame);
     void SetNumColorFrames(unsigned number);
     void SetNumColorFrames(unsigned number);
     void SortColorFrames();
     void SortColorFrames();
-    void AddTextureTime(const Rect& uv, const float time);
+    void AddTextureTime(const Rect& uv, float time);
     void AddTextureFrame(const TextureFrame& textureFrame);
     void AddTextureFrame(const TextureFrame& textureFrame);
     void RemoveTextureFrame(unsigned index);
     void RemoveTextureFrame(unsigned index);
     void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
     void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
     void SetNumTextureFrames(unsigned number);
     void SetNumTextureFrames(unsigned number);
     void SortTextureFrames();
     void SortTextureFrames();
-    
+
     // SharedPtr<ParticleEffect> Clone(const String cloneName = String::EMPTY) const;
     // SharedPtr<ParticleEffect> Clone(const String cloneName = String::EMPTY) const;
     tolua_outside ParticleEffect* ParticleEffectClone @ Clone(const String cloneName = String::EMPTY) const;
     tolua_outside ParticleEffect* ParticleEffectClone @ Clone(const String cloneName = String::EMPTY) const;
 
 

+ 1 - 1
Source/Urho3D/Math/Frustum.h

@@ -171,7 +171,7 @@ public:
     /// Return transformed by a 3x4 matrix.
     /// Return transformed by a 3x4 matrix.
     Frustum Transformed(const Matrix3x4& transform) const;
     Frustum Transformed(const Matrix3x4& transform) const;
     /// Return projected by a 4x4 projection matrix.
     /// Return projected by a 4x4 projection matrix.
-    Rect Projected(const Matrix4& transform) const;
+    Rect Projected(const Matrix4& projection) const;
 
 
     /// Update the planes. Called internally.
     /// Update the planes. Called internally.
     void UpdatePlanes();
     void UpdatePlanes();

+ 11 - 11
Source/Urho3D/Math/MathDefs.h

@@ -154,37 +154,37 @@ template <class T> inline T Atan(T x) { return M_RADTODEG * atan(x); }
 template <class T> inline T Atan2(T y, T x) { return M_RADTODEG * atan2(y, x); }
 template <class T> inline T Atan2(T y, T x) { return M_RADTODEG * atan2(y, x); }
 
 
 /// Return X in power Y.
 /// Return X in power Y.
-template <class T> T Pow(T x, T y) { return pow(x, y); }
+template <class T> inline T Pow(T x, T y) { return pow(x, y); }
 
 
 /// Return natural logarithm of X.
 /// Return natural logarithm of X.
-template <class T> T Ln(T x) { return log(x); }
+template <class T> inline T Ln(T x) { return log(x); }
 
 
 /// Return square root of X.
 /// Return square root of X.
-template <class T> T Sqrt(T x) { return sqrt(x); }
+template <class T> inline T Sqrt(T x) { return sqrt(x); }
 
 
 /// Return floating-point remainder of X/Y.
 /// Return floating-point remainder of X/Y.
-template <class T> T Mod(T x, T y) { return fmod(x, y); }
+template <class T> inline T Mod(T x, T y) { return fmod(x, y); }
 
 
 /// Return fractional part of passed value in range [0, 1).
 /// Return fractional part of passed value in range [0, 1).
-template <class T> T Fract(T value) { return value - floor(value); }
+template <class T> inline T Fract(T value) { return value - floor(value); }
 
 
 /// Round value down.
 /// Round value down.
-template <class T> T Floor(T x) { return floor(x); }
+template <class T> inline T Floor(T x) { return floor(x); }
 
 
 /// Round value down. Returns integer value.
 /// Round value down. Returns integer value.
-template <class T> int FloorToInt(T x) { return static_cast<int>(floor(x)); }
+template <class T> inline int FloorToInt(T x) { return static_cast<int>(floor(x)); }
 
 
 /// Round value to nearest integer.
 /// Round value to nearest integer.
-template <class T> T Round(T x) { return floor(x + T(0.5)); }
+template <class T> inline T Round(T x) { return round(x); }
 
 
 /// Round value to nearest integer.
 /// Round value to nearest integer.
-template <class T> int RoundToInt(T x) { return static_cast<int>(floor(x + T(0.5))); }
+template <class T> inline int RoundToInt(T x) { return static_cast<int>(round(x)); }
 
 
 /// Round value up.
 /// Round value up.
-template <class T> T Ceil(T x) { return ceil(x); }
+template <class T> inline T Ceil(T x) { return ceil(x); }
 
 
 /// Round value up.
 /// Round value up.
-template <class T> int CeilToInt(T x) { return static_cast<int>(ceil(x)); }
+template <class T> inline int CeilToInt(T x) { return static_cast<int>(ceil(x)); }
 
 
 /// Check whether an unsigned integer is a power of two.
 /// Check whether an unsigned integer is a power of two.
 inline bool IsPowerOfTwo(unsigned value)
 inline bool IsPowerOfTwo(unsigned value)

+ 2 - 2
Source/Urho3D/Math/Matrix4.h

@@ -585,7 +585,7 @@ public:
         __m128 m1 = _mm_loadu_ps(&m10_);
         __m128 m1 = _mm_loadu_ps(&m10_);
         __m128 m2 = _mm_loadu_ps(&m20_);
         __m128 m2 = _mm_loadu_ps(&m20_);
         __m128 m3 = _mm_loadu_ps(&m30_);
         __m128 m3 = _mm_loadu_ps(&m30_);
-        _MM_TRANSPOSE4_PS(m0, m1, m2, m3);      // NOLINT
+        _MM_TRANSPOSE4_PS(m0, m1, m2, m3);      // NOLINT(modernize-use-bool-literals)
         Matrix4 out;
         Matrix4 out;
         _mm_storeu_ps(&out.m00_, m0);
         _mm_storeu_ps(&out.m00_, m0);
         _mm_storeu_ps(&out.m10_, m1);
         _mm_storeu_ps(&out.m10_, m1);
@@ -677,7 +677,7 @@ public:
             __m128 m1 = _mm_loadu_ps(src + 4);
             __m128 m1 = _mm_loadu_ps(src + 4);
             __m128 m2 = _mm_loadu_ps(src + 8);
             __m128 m2 = _mm_loadu_ps(src + 8);
             __m128 m3 = _mm_loadu_ps(src + 12);
             __m128 m3 = _mm_loadu_ps(src + 12);
-            _MM_TRANSPOSE4_PS(m0, m1, m2, m3);      // NOLINT
+            _MM_TRANSPOSE4_PS(m0, m1, m2, m3);      // NOLINT(modernize-use-bool-literals)
             _mm_storeu_ps(dest, m0);
             _mm_storeu_ps(dest, m0);
             _mm_storeu_ps(dest + 4, m1);
             _mm_storeu_ps(dest + 4, m1);
             _mm_storeu_ps(dest + 8, m2);
             _mm_storeu_ps(dest + 8, m2);

+ 1 - 1
Source/Urho3D/Math/Polyhedron.h

@@ -88,7 +88,7 @@ public:
     /// Clip with a bounding box.
     /// Clip with a bounding box.
     void Clip(const BoundingBox& box);
     void Clip(const BoundingBox& box);
     /// Clip with a frustum.
     /// Clip with a frustum.
-    void Clip(const Frustum& box);
+    void Clip(const Frustum& frustum);
     /// Clear all faces.
     /// Clear all faces.
     void Clear();
     void Clear();
     /// Transform with a 3x3 matrix.
     /// Transform with a 3x3 matrix.

+ 3 - 3
Source/Urho3D/Math/Quaternion.cpp

@@ -148,13 +148,13 @@ void Quaternion::FromRotationMatrix(const Matrix3& matrix)
     }
     }
 }
 }
 
 
-bool Quaternion::FromLookRotation(const Vector3& direction, const Vector3& upDirection)
+bool Quaternion::FromLookRotation(const Vector3& direction, const Vector3& up)
 {
 {
     Quaternion ret;
     Quaternion ret;
     Vector3 forward = direction.Normalized();
     Vector3 forward = direction.Normalized();
 
 
-    Vector3 v = forward.CrossProduct(upDirection);
-    // If direction & upDirection are parallel and crossproduct becomes zero, use FromRotationTo() fallback
+    Vector3 v = forward.CrossProduct(up);
+    // If direction & up are parallel and crossproduct becomes zero, use FromRotationTo() fallback
     if (v.LengthSquared() >= M_EPSILON)
     if (v.LengthSquared() >= M_EPSILON)
     {
     {
         v.Normalize();
         v.Normalize();

+ 2 - 2
Source/Urho3D/Math/StringHash.h

@@ -47,9 +47,9 @@ public:
     }
     }
 
 
     /// Construct from a C string case-insensitively.
     /// Construct from a C string case-insensitively.
-    StringHash(const char* str) noexcept;        // NOLINT
+    StringHash(const char* str) noexcept;        // NOLINT(google-explicit-constructor)
     /// Construct from a string case-insensitively.
     /// Construct from a string case-insensitively.
-    StringHash(const String& str) noexcept;      // NOLINT
+    StringHash(const String& str) noexcept;      // NOLINT(google-explicit-constructor)
 
 
     /// Assign from another hash.
     /// Assign from another hash.
     StringHash& operator =(const StringHash& rhs) noexcept = default;
     StringHash& operator =(const StringHash& rhs) noexcept = default;

+ 1 - 1
Source/Urho3D/Navigation/NavBuildData.h

@@ -102,7 +102,7 @@ struct SimpleNavBuildData : public NavBuildData
 struct DynamicNavBuildData : public NavBuildData
 struct DynamicNavBuildData : public NavBuildData
 {
 {
     /// Constructor.
     /// Constructor.
-    explicit DynamicNavBuildData(dtTileCacheAlloc* alloc);
+    explicit DynamicNavBuildData(dtTileCacheAlloc* allocator);
     /// Destructor.
     /// Destructor.
     ~DynamicNavBuildData() override;
     ~DynamicNavBuildData() override;
 
 

+ 2 - 2
Source/Urho3D/Navigation/NavigationMesh.cpp

@@ -1579,9 +1579,9 @@ void NavigationMesh::ReleaseNavigationMesh()
     boundingBox_.Clear();
     boundingBox_.Clear();
 }
 }
 
 
-void NavigationMesh::SetPartitionType(NavmeshPartitionType ptype)
+void NavigationMesh::SetPartitionType(NavmeshPartitionType partitionType)
 {
 {
-    partitionType_ = ptype;
+    partitionType_ = partitionType;
     MarkNetworkUpdate();
     MarkNetworkUpdate();
 }
 }
 
 

+ 1 - 1
Source/Urho3D/Navigation/NavigationMesh.h

@@ -250,7 +250,7 @@ public:
     IntVector2 GetNumTiles() const { return IntVector2(numTilesX_, numTilesZ_); }
     IntVector2 GetNumTiles() const { return IntVector2(numTilesX_, numTilesZ_); }
 
 
     /// Set the partition type used for polygon generation.
     /// Set the partition type used for polygon generation.
-    void SetPartitionType(NavmeshPartitionType aType);
+    void SetPartitionType(NavmeshPartitionType partitionType);
 
 
     /// Return Partition Type.
     /// Return Partition Type.
     NavmeshPartitionType GetPartitionType() const { return partitionType_; }
     NavmeshPartitionType GetPartitionType() const { return partitionType_; }

+ 1 - 1
Source/Urho3D/Network/Connection.cpp

@@ -739,7 +739,7 @@ void Connection::ProcessPackageDownload(int msgID, MemoryBuffer& msg)
             for (unsigned i = 0; i < packages.Size(); ++i)
             for (unsigned i = 0; i < packages.Size(); ++i)
             {
             {
                 PackageFile* package = packages[i];
                 PackageFile* package = packages[i];
-                String packageFullName = package->GetName();
+                const String& packageFullName = package->GetName();
                 if (!GetFileNameAndExtension(packageFullName).Compare(name, false))
                 if (!GetFileNameAndExtension(packageFullName).Compare(name, false))
                 {
                 {
                     StringHash nameHash(name);
                     StringHash nameHash(name);

+ 2 - 2
Source/Urho3D/Network/Network.cpp

@@ -345,9 +345,9 @@ void Network::SetSimulatedLatency(int ms)
     ConfigureNetworkSimulator();
     ConfigureNetworkSimulator();
 }
 }
 
 
-void Network::SetSimulatedPacketLoss(float loss)
+void Network::SetSimulatedPacketLoss(float probability)
 {
 {
-    simulatedPacketLoss_ = Clamp(loss, 0.0f, 1.0f);
+    simulatedPacketLoss_ = Clamp(probability, 0.0f, 1.0f);
     ConfigureNetworkSimulator();
     ConfigureNetworkSimulator();
 }
 }
 
 

+ 5 - 4
Source/Urho3D/Physics/PhysicsWorld.cpp

@@ -450,12 +450,12 @@ void PhysicsWorld::RaycastSingleSegmented(PhysicsRaycastResult& result, const Ra
     btVector3 start = ToBtVector3(ray.origin_);
     btVector3 start = ToBtVector3(ray.origin_);
     btVector3 end;
     btVector3 end;
     btVector3 direction = ToBtVector3(ray.direction_);
     btVector3 direction = ToBtVector3(ray.direction_);
-    float distance;
+    float remainingDistance = maxDistance;
+    auto count = RoundToInt(maxDistance / segmentDistance);
 
 
-    for (float remainingDistance = maxDistance; remainingDistance > 0; remainingDistance -= segmentDistance)
+    for (auto i = 0; i < count; ++i)
     {
     {
-        distance = Min(remainingDistance, segmentDistance);
-
+        float distance = Min(remainingDistance, segmentDistance);     // The last segment may be shorter
         end = start + distance * direction;
         end = start + distance * direction;
 
 
         btCollisionWorld::ClosestRayResultCallback rayCallback(start, end);
         btCollisionWorld::ClosestRayResultCallback rayCallback(start, end);
@@ -477,6 +477,7 @@ void PhysicsWorld::RaycastSingleSegmented(PhysicsRaycastResult& result, const Ra
 
 
         // Use the end position as the new start position
         // Use the end position as the new start position
         start = end;
         start = end;
+        remainingDistance -= segmentDistance;
     }
     }
 
 
     // Didn't hit anything
     // Didn't hit anything

+ 3 - 3
Source/Urho3D/Physics/PhysicsWorld.h

@@ -139,7 +139,7 @@ class URHO3D_API PhysicsWorld : public Component, public btIDebugDraw
 
 
 public:
 public:
     /// Construct.
     /// Construct.
-    explicit PhysicsWorld(Context* scontext);
+    explicit PhysicsWorld(Context* context);
     /// Destruct.
     /// Destruct.
     ~PhysicsWorld() override;
     ~PhysicsWorld() override;
     /// Register object factory.
     /// Register object factory.
@@ -251,9 +251,9 @@ public:
     /// Remove a collision shape. Called by CollisionShape.
     /// Remove a collision shape. Called by CollisionShape.
     void RemoveCollisionShape(CollisionShape* shape);
     void RemoveCollisionShape(CollisionShape* shape);
     /// Add a constraint to keep track of. Called by Constraint.
     /// Add a constraint to keep track of. Called by Constraint.
-    void AddConstraint(Constraint* joint);
+    void AddConstraint(Constraint* constraint);
     /// Remove a constraint. Called by Constraint.
     /// Remove a constraint. Called by Constraint.
-    void RemoveConstraint(Constraint* joint);
+    void RemoveConstraint(Constraint* constraint);
     /// Add a delayed world transform assignment. Called by RigidBody.
     /// Add a delayed world transform assignment. Called by RigidBody.
     void AddDelayedWorldTransform(const DelayedWorldTransform& transform);
     void AddDelayedWorldTransform(const DelayedWorldTransform& transform);
     /// Add debug geometry to the debug renderer.
     /// Add debug geometry to the debug renderer.

+ 1 - 1
Source/Urho3D/Physics/RaycastVehicle.cpp

@@ -412,7 +412,7 @@ Vector3 RaycastVehicle::GetWheelPosition(int wheel)
 Quaternion RaycastVehicle::GetWheelRotation(int wheel)
 Quaternion RaycastVehicle::GetWheelRotation(int wheel)
 {
 {
     btRaycastVehicle* vehicle = vehicleData_->Get();
     btRaycastVehicle* vehicle = vehicleData_->Get();
-    btTransform transform = vehicle->getWheelTransformWS(wheel);
+    const btTransform& transform = vehicle->getWheelTransformWS(wheel);
     Quaternion rotation = ToQuaternion(transform.getRotation());
     Quaternion rotation = ToQuaternion(transform.getRotation());
     return rotation;
     return rotation;
 }
 }

+ 2 - 2
Source/Urho3D/Physics/RigidBody.h

@@ -87,13 +87,13 @@ public:
     /// Set linear velocity damping factor.
     /// Set linear velocity damping factor.
     void SetLinearDamping(float damping);
     void SetLinearDamping(float damping);
     /// Set angular velocity.
     /// Set angular velocity.
-    void SetAngularVelocity(const Vector3& angularVelocity);
+    void SetAngularVelocity(const Vector3& velocity);
     /// Set angular degrees of freedom. Use 1 to enable an axis or 0 to disable. Default is all axes enabled (1, 1, 1).
     /// Set angular degrees of freedom. Use 1 to enable an axis or 0 to disable. Default is all axes enabled (1, 1, 1).
     void SetAngularFactor(const Vector3& factor);
     void SetAngularFactor(const Vector3& factor);
     /// Set angular velocity deactivation threshold.
     /// Set angular velocity deactivation threshold.
     void SetAngularRestThreshold(float threshold);
     void SetAngularRestThreshold(float threshold);
     /// Set angular velocity damping factor.
     /// Set angular velocity damping factor.
-    void SetAngularDamping(float factor);
+    void SetAngularDamping(float damping);
     /// Set friction coefficient.
     /// Set friction coefficient.
     void SetFriction(float friction);
     void SetFriction(float friction);
     /// Set anisotropic friction.
     /// Set anisotropic friction.

+ 1 - 1
Source/Urho3D/Resource/BackgroundLoader.cpp

@@ -242,7 +242,7 @@ void BackgroundLoader::FinishResources(int maxMs)
             }
             }
 
 
             // Break when the time limit passed so that we keep sufficient FPS
             // Break when the time limit passed so that we keep sufficient FPS
-            if (timer.GetUSec(false) >= maxMs * 1000)
+            if (timer.GetUSec(false) >= maxMs * 1000LL)
                 break;
                 break;
         }
         }
 
 

+ 5 - 5
Source/Urho3D/Resource/Decompress.cpp

@@ -802,7 +802,7 @@ static unsigned TwiddleUV(unsigned YSize, unsigned XSize, unsigned YPos, unsigne
     return Twiddled;
     return Twiddled;
 }
 }
 
 
-void DecompressImagePVRTC(unsigned char* dest, const void* blocks, int width, int height, CompressedFormat format)
+void DecompressImagePVRTC(unsigned char* rgba, const void* blocks, int width, int height, CompressedFormat format)
 {
 {
     auto* pCompressedData = (AMTC_BLOCK_STRUCT*)blocks;
     auto* pCompressedData = (AMTC_BLOCK_STRUCT*)blocks;
     int AssumeImageTiles = 1;
     int AssumeImageTiles = 1;
@@ -940,10 +940,10 @@ void DecompressImagePVRTC(unsigned char* dest, const void* blocks, int width, in
 
 
             // Store the result in the output image
             // Store the result in the output image
             uPosition = (unsigned)((x + y * width) << 2);
             uPosition = (unsigned)((x + y * width) << 2);
-            dest[uPosition + 0] = (unsigned char)Result[0];
-            dest[uPosition + 1] = (unsigned char)Result[1];
-            dest[uPosition + 2] = (unsigned char)Result[2];
-            dest[uPosition + 3] = (unsigned char)Result[3];
+            rgba[uPosition + 0] = (unsigned char)Result[0];
+            rgba[uPosition + 1] = (unsigned char)Result[1];
+            rgba[uPosition + 2] = (unsigned char)Result[2];
+            rgba[uPosition + 3] = (unsigned char)Result[3];
         }
         }
     }
     }
 }
 }

+ 3 - 3
Source/Urho3D/Resource/Decompress.h

@@ -29,11 +29,11 @@ namespace Urho3D
 
 
 /// Decompress a DXT compressed image to RGBA.
 /// Decompress a DXT compressed image to RGBA.
 URHO3D_API void
 URHO3D_API void
-    DecompressImageDXT(unsigned char* dest, const void* blocks, int width, int height, int depth, CompressedFormat format);
+    DecompressImageDXT(unsigned char* rgba, const void* blocks, int width, int height, int depth, CompressedFormat format);
 /// Decompress an ETC1 compressed image to RGBA.
 /// Decompress an ETC1 compressed image to RGBA.
-URHO3D_API void DecompressImageETC(unsigned char* dest, const void* blocks, int width, int height);
+URHO3D_API void DecompressImageETC(unsigned char* rgba, const void* blocks, int width, int height);
 /// Decompress a PVRTC compressed image to RGBA.
 /// Decompress a PVRTC compressed image to RGBA.
-URHO3D_API void DecompressImagePVRTC(unsigned char* dest, const void* blocks, int width, int height, CompressedFormat format);
+URHO3D_API void DecompressImagePVRTC(unsigned char* rgba, const void* blocks, int width, int height, CompressedFormat format);
 /// Flip a compressed block vertically.
 /// Flip a compressed block vertically.
 URHO3D_API void FlipBlockVertical(unsigned char* dest, unsigned char* src, CompressedFormat format);
 URHO3D_API void FlipBlockVertical(unsigned char* dest, unsigned char* src, CompressedFormat format);
 /// Flip a compressed block horizontally.
 /// Flip a compressed block horizontally.

+ 12 - 12
Source/Urho3D/Resource/Image.cpp

@@ -441,15 +441,15 @@ bool Image::BeginLoad(Deserializer& source)
                 unsigned numPixels = dataSize / sourcePixelByteSize;
                 unsigned numPixels = dataSize / sourcePixelByteSize;
 
 
 #define ADJUSTSHIFT(mask, l, r) \
 #define ADJUSTSHIFT(mask, l, r) \
-                if (mask && mask >= 0x100) \
+                if ((mask) >= 0x100) \
                 { \
                 { \
-                    while ((mask >> r) >= 0x100) \
-                    ++r; \
+                    while (((mask) >> (r)) >= 0x100) \
+                    ++(r); \
                 } \
                 } \
-                else if (mask && mask < 0x80) \
+                else if ((mask) && (mask) < 0x80) \
                 { \
                 { \
-                    while ((mask << l) < 0x80) \
-                    ++l; \
+                    while (((mask) << (l)) < 0x80) \
+                    ++(l); \
                 }
                 }
 
 
                 unsigned rShiftL = 0, gShiftL = 0, bShiftL = 0, aShiftL = 0;
                 unsigned rShiftL = 0, gShiftL = 0, bShiftL = 0, aShiftL = 0;
@@ -760,7 +760,7 @@ bool Image::BeginLoad(Deserializer& source)
             return false;
             return false;
         }
         }
         const uint8_t WEBP[TAG_SIZE] = {'W', 'E', 'B', 'P'};
         const uint8_t WEBP[TAG_SIZE] = {'W', 'E', 'B', 'P'};
-        if (memcmp(fourCC, WEBP, TAG_SIZE))
+        if (memcmp(fourCC, WEBP, TAG_SIZE) != 0)
         {
         {
             // VP8_STATUS_BITSTREAM_ERROR
             // VP8_STATUS_BITSTREAM_ERROR
             URHO3D_LOGERROR("Invalid header");
             URHO3D_LOGERROR("Invalid header");
@@ -783,7 +783,7 @@ bool Image::BeginLoad(Deserializer& source)
             return false;
             return false;
         }
         }
 
 
-        size_t imgSize(features.width * features.height * (features.has_alpha ? 4 : 3));
+        size_t imgSize = (size_t)features.width * features.height * (features.has_alpha ? 4 : 3);
         SharedArrayPtr<uint8_t> pixelData(new uint8_t[imgSize]);
         SharedArrayPtr<uint8_t> pixelData(new uint8_t[imgSize]);
 
 
         bool decodeError(false);
         bool decodeError(false);
@@ -949,7 +949,7 @@ void Image::SetData(const unsigned char* pixelData)
         return;
         return;
     }
     }
 
 
-    memcpy(data_.Get(), pixelData, width_ * height_ * depth_ * components_);
+    memcpy(data_.Get(), pixelData, (size_t)width_ * height_ * depth_ * components_);
     nextLevel_.Reset();
     nextLevel_.Reset();
 }
 }
 
 
@@ -2101,7 +2101,7 @@ Image* Image::GetSubimage(const IntRect& rect) const
         unsigned char* src = data_.Get() + (y * width_ + x) * components_;
         unsigned char* src = data_.Get() + (y * width_ + x) * components_;
         for (int i = 0; i < height; ++i)
         for (int i = 0; i < height; ++i)
         {
         {
-            memcpy(dest, src, width * components_);
+            memcpy(dest, src, (size_t)width * components_);
             dest += width * components_;
             dest += width * components_;
             src += width_ * components_;
             src += width_ * components_;
         }
         }
@@ -2231,7 +2231,7 @@ SDL_Surface* Image::GetSDLSurface(const IntRect& rect) const
         unsigned char* source = data_ + components_ * (imageWidth * imageRect.top_ + imageRect.left_);
         unsigned char* source = data_ + components_ * (imageWidth * imageRect.top_ + imageRect.left_);
         for (int i = 0; i < height; ++i)
         for (int i = 0; i < height; ++i)
         {
         {
-            memcpy(destination, source, components_ * width);
+            memcpy(destination, source, (size_t)components_ * width);
             destination += surface->pitch;
             destination += surface->pitch;
             source += components_ * imageWidth;
             source += components_ * imageWidth;
         }
         }
@@ -2348,7 +2348,7 @@ bool Image::SetSubimage(const Image* image, const IntRect& rect)
         unsigned char* dest = data_.Get() + (rect.top_ * width_ + rect.left_) * components_;
         unsigned char* dest = data_.Get() + (rect.top_ * width_ + rect.left_) * components_;
         for (int i = 0; i < destHeight; ++i)
         for (int i = 0; i < destHeight; ++i)
         {
         {
-            memcpy(dest, src, destWidth * components_);
+            memcpy(dest, src, (size_t)destWidth * components_);
 
 
             src += destWidth * image->components_;
             src += destWidth * image->components_;
             dest += width_ * components_;
             dest += width_ * components_;

+ 9 - 9
Source/Urho3D/Resource/JSONValue.h

@@ -78,55 +78,55 @@ public:
     {
     {
     }
     }
     /// Construct with a boolean.
     /// Construct with a boolean.
-    JSONValue(bool value) :         // NOLINT
+    JSONValue(bool value) :         // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a integer.
     /// Construct with a integer.
-    JSONValue(int value) :          // NOLINT
+    JSONValue(int value) :          // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a unsigned integer.
     /// Construct with a unsigned integer.
-    JSONValue(unsigned value) :     // NOLINT
+    JSONValue(unsigned value) :     // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a float.
     /// Construct with a float.
-    JSONValue(float value) :        // NOLINT
+    JSONValue(float value) :        // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a double.
     /// Construct with a double.
-    JSONValue(double value) :       // NOLINT
+    JSONValue(double value) :       // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a string.
     /// Construct with a string.
-    JSONValue(const String& value) :    // NOLINT
+    JSONValue(const String& value) :    // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a C string.
     /// Construct with a C string.
-    JSONValue(const char* value) :      // NOLINT
+    JSONValue(const char* value) :      // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a JSON array.
     /// Construct with a JSON array.
-    JSONValue(const JSONArray& value) :     // NOLINT
+    JSONValue(const JSONArray& value) :     // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;
     }
     }
     /// Construct with a JSON object.
     /// Construct with a JSON object.
-    JSONValue(const JSONObject& value) :    // NOLINT
+    JSONValue(const JSONObject& value) :    // NOLINT(google-explicit-constructor)
         type_(0)
         type_(0)
     {
     {
         *this = value;
         *this = value;

+ 3 - 3
Source/Urho3D/Resource/PListFile.cpp

@@ -215,7 +215,7 @@ IntRect PListValue::GetIntRect() const
         return IntRect::ZERO;
         return IntRect::ZERO;
 
 
     int x, y, w, h;
     int x, y, w, h;
-    sscanf(string_->CString(), "{{%d,%d},{%d,%d}}", &x, &y, &w, &h);
+    sscanf(string_->CString(), "{{%d,%d},{%d,%d}}", &x, &y, &w, &h);    // NOLINT(cert-err34-c)
     return {x, y, x + w, y + h};
     return {x, y, x + w, y + h};
 }
 }
 
 
@@ -225,7 +225,7 @@ IntVector2 PListValue::GetIntVector2() const
         return IntVector2::ZERO;
         return IntVector2::ZERO;
 
 
     int x, y;
     int x, y;
-    sscanf(string_->CString(), "{%d,%d}", &x, &y);
+    sscanf(string_->CString(), "{%d,%d}", &x, &y);                      // NOLINT(cert-err34-c)
     return IntVector2(x, y);
     return IntVector2(x, y);
 }
 }
 
 
@@ -235,7 +235,7 @@ IntVector3 PListValue::GetIntVector3() const
         return IntVector3::ZERO;
         return IntVector3::ZERO;
 
 
     int x, y, z;
     int x, y, z;
-    sscanf(string_->CString(), "{%d,%d,%d}", &x, &y, &z);
+    sscanf(string_->CString(), "{%d,%d,%d}", &x, &y, &z);               // NOLINT(cert-err34-c)
     return IntVector3(x, y, z);
     return IntVector3(x, y, z);
 }
 }
 
 

+ 64 - 64
Source/Urho3D/Resource/ResourceCache.cpp

@@ -485,34 +485,34 @@ void ResourceCache::RemoveResourceRouter(ResourceRouter* router)
     }
     }
 }
 }
 
 
-SharedPtr<File> ResourceCache::GetFile(const String& nameIn, bool sendEventOnFailure)
+SharedPtr<File> ResourceCache::GetFile(const String& name, bool sendEventOnFailure)
 {
 {
     MutexLock lock(resourceMutex_);
     MutexLock lock(resourceMutex_);
 
 
-    String name = SanitateResourceName(nameIn);
+    String sanitatedName = SanitateResourceName(name);
     if (!isRouting_)
     if (!isRouting_)
     {
     {
         isRouting_ = true;
         isRouting_ = true;
         for (unsigned i = 0; i < resourceRouters_.Size(); ++i)
         for (unsigned i = 0; i < resourceRouters_.Size(); ++i)
-            resourceRouters_[i]->Route(name, RESOURCE_GETFILE);
+            resourceRouters_[i]->Route(sanitatedName, RESOURCE_GETFILE);
         isRouting_ = false;
         isRouting_ = false;
     }
     }
 
 
-    if (name.Length())
+    if (sanitatedName.Length())
     {
     {
         File* file = nullptr;
         File* file = nullptr;
 
 
         if (searchPackagesFirst_)
         if (searchPackagesFirst_)
         {
         {
-            file = SearchPackages(name);
+            file = SearchPackages(sanitatedName);
             if (!file)
             if (!file)
-                file = SearchResourceDirs(name);
+                file = SearchResourceDirs(sanitatedName);
         }
         }
         else
         else
         {
         {
-            file = SearchResourceDirs(name);
+            file = SearchResourceDirs(sanitatedName);
             if (!file)
             if (!file)
-                file = SearchPackages(name);
+                file = SearchPackages(sanitatedName);
         }
         }
 
 
         if (file)
         if (file)
@@ -521,17 +521,17 @@ SharedPtr<File> ResourceCache::GetFile(const String& nameIn, bool sendEventOnFai
 
 
     if (sendEventOnFailure)
     if (sendEventOnFailure)
     {
     {
-        if (resourceRouters_.Size() && name.Empty() && !nameIn.Empty())
-            URHO3D_LOGERROR("Resource request " + nameIn + " was blocked");
+        if (resourceRouters_.Size() && sanitatedName.Empty() && !name.Empty())
+            URHO3D_LOGERROR("Resource request " + name + " was blocked");
         else
         else
-            URHO3D_LOGERROR("Could not find resource " + name);
+            URHO3D_LOGERROR("Could not find resource " + sanitatedName);
 
 
         if (Thread::IsMainThread())
         if (Thread::IsMainThread())
         {
         {
             using namespace ResourceNotFound;
             using namespace ResourceNotFound;
 
 
             VariantMap& eventData = GetEventDataMap();
             VariantMap& eventData = GetEventDataMap();
-            eventData[P_RESOURCENAME] = name.Length() ? name : nameIn;
+            eventData[P_RESOURCENAME] = sanitatedName.Length() ? sanitatedName : name;
             SendEvent(E_RESOURCENOTFOUND, eventData);
             SendEvent(E_RESOURCENOTFOUND, eventData);
         }
         }
     }
     }
@@ -539,41 +539,41 @@ SharedPtr<File> ResourceCache::GetFile(const String& nameIn, bool sendEventOnFai
     return SharedPtr<File>();
     return SharedPtr<File>();
 }
 }
 
 
-Resource* ResourceCache::GetExistingResource(StringHash type, const String& nameIn)
+Resource* ResourceCache::GetExistingResource(StringHash type, const String& name)
 {
 {
-    String name = SanitateResourceName(nameIn);
+    String sanitatedName = SanitateResourceName(name);
 
 
     if (!Thread::IsMainThread())
     if (!Thread::IsMainThread())
     {
     {
-        URHO3D_LOGERROR("Attempted to get resource " + name + " from outside the main thread");
+        URHO3D_LOGERROR("Attempted to get resource " + sanitatedName + " from outside the main thread");
         return nullptr;
         return nullptr;
     }
     }
 
 
     // If empty name, return null pointer immediately
     // If empty name, return null pointer immediately
-    if (name.Empty())
+    if (sanitatedName.Empty())
         return nullptr;
         return nullptr;
 
 
-    StringHash nameHash(name);
+    StringHash nameHash(sanitatedName);
 
 
     const SharedPtr<Resource>& existing = FindResource(type, nameHash);
     const SharedPtr<Resource>& existing = FindResource(type, nameHash);
     return existing;
     return existing;
 }
 }
 
 
-Resource* ResourceCache::GetResource(StringHash type, const String& nameIn, bool sendEventOnFailure)
+Resource* ResourceCache::GetResource(StringHash type, const String& name, bool sendEventOnFailure)
 {
 {
-    String name = SanitateResourceName(nameIn);
+    String sanitatedName = SanitateResourceName(name);
 
 
     if (!Thread::IsMainThread())
     if (!Thread::IsMainThread())
     {
     {
-        URHO3D_LOGERROR("Attempted to get resource " + name + " from outside the main thread");
+        URHO3D_LOGERROR("Attempted to get resource " + sanitatedName + " from outside the main thread");
         return nullptr;
         return nullptr;
     }
     }
 
 
     // If empty name, return null pointer immediately
     // If empty name, return null pointer immediately
-    if (name.Empty())
+    if (sanitatedName.Empty())
         return nullptr;
         return nullptr;
 
 
-    StringHash nameHash(name);
+    StringHash nameHash(sanitatedName);
 
 
 #ifdef URHO3D_THREADING
 #ifdef URHO3D_THREADING
     // Check if the resource is being background loaded but is now needed immediately
     // Check if the resource is being background loaded but is now needed immediately
@@ -604,12 +604,12 @@ Resource* ResourceCache::GetResource(StringHash type, const String& nameIn, bool
     }
     }
 
 
     // Attempt to load the resource
     // Attempt to load the resource
-    SharedPtr<File> file = GetFile(name, sendEventOnFailure);
+    SharedPtr<File> file = GetFile(sanitatedName, sendEventOnFailure);
     if (!file)
     if (!file)
         return nullptr;   // Error is already logged
         return nullptr;   // Error is already logged
 
 
-    URHO3D_LOGDEBUG("Loading resource " + name);
-    resource->SetName(name);
+    URHO3D_LOGDEBUG("Loading resource " + sanitatedName);
+    resource->SetName(sanitatedName);
 
 
     if (!resource->Load(*(file.Get())))
     if (!resource->Load(*(file.Get())))
     {
     {
@@ -619,7 +619,7 @@ Resource* ResourceCache::GetResource(StringHash type, const String& nameIn, bool
             using namespace LoadFailed;
             using namespace LoadFailed;
 
 
             VariantMap& eventData = GetEventDataMap();
             VariantMap& eventData = GetEventDataMap();
-            eventData[P_RESOURCENAME] = name;
+            eventData[P_RESOURCENAME] = sanitatedName;
             SendEvent(E_LOADFAILED, eventData);
             SendEvent(E_LOADFAILED, eventData);
         }
         }
 
 
@@ -635,32 +635,32 @@ Resource* ResourceCache::GetResource(StringHash type, const String& nameIn, bool
     return resource;
     return resource;
 }
 }
 
 
-bool ResourceCache::BackgroundLoadResource(StringHash type, const String& nameIn, bool sendEventOnFailure, Resource* caller)
+bool ResourceCache::BackgroundLoadResource(StringHash type, const String& name, bool sendEventOnFailure, Resource* caller)
 {
 {
 #ifdef URHO3D_THREADING
 #ifdef URHO3D_THREADING
     // If empty name, fail immediately
     // If empty name, fail immediately
-    String name = SanitateResourceName(nameIn);
-    if (name.Empty())
+    String sanitatedName = SanitateResourceName(name);
+    if (sanitatedName.Empty())
         return false;
         return false;
 
 
     // First check if already exists as a loaded resource
     // First check if already exists as a loaded resource
-    StringHash nameHash(name);
+    StringHash nameHash(sanitatedName);
     if (FindResource(type, nameHash) != noResource)
     if (FindResource(type, nameHash) != noResource)
         return false;
         return false;
 
 
-    return backgroundLoader_->QueueResource(type, name, sendEventOnFailure, caller);
+    return backgroundLoader_->QueueResource(type, sanitatedName, sendEventOnFailure, caller);
 #else
 #else
     // When threading not supported, fall back to synchronous loading
     // When threading not supported, fall back to synchronous loading
-    return GetResource(type, nameIn, sendEventOnFailure);
+    return GetResource(type, name, sendEventOnFailure);
 #endif
 #endif
 }
 }
 
 
-SharedPtr<Resource> ResourceCache::GetTempResource(StringHash type, const String& nameIn, bool sendEventOnFailure)
+SharedPtr<Resource> ResourceCache::GetTempResource(StringHash type, const String& name, bool sendEventOnFailure)
 {
 {
-    String name = SanitateResourceName(nameIn);
+    String sanitatedName = SanitateResourceName(name);
 
 
     // If empty name, return null pointer immediately
     // If empty name, return null pointer immediately
-    if (name.Empty())
+    if (sanitatedName.Empty())
         return SharedPtr<Resource>();
         return SharedPtr<Resource>();
 
 
     SharedPtr<Resource> resource;
     SharedPtr<Resource> resource;
@@ -683,11 +683,11 @@ SharedPtr<Resource> ResourceCache::GetTempResource(StringHash type, const String
     }
     }
 
 
     // Attempt to load the resource
     // Attempt to load the resource
-    SharedPtr<File> file = GetFile(name, sendEventOnFailure);
+    SharedPtr<File> file = GetFile(sanitatedName, sendEventOnFailure);
     if (!file)
     if (!file)
         return SharedPtr<Resource>();  // Error is already logged
         return SharedPtr<Resource>();  // Error is already logged
 
 
-    URHO3D_LOGDEBUG("Loading temporary resource " + name);
+    URHO3D_LOGDEBUG("Loading temporary resource " + sanitatedName);
     resource->SetName(file->GetName());
     resource->SetName(file->GetName());
 
 
     if (!resource->Load(*(file.Get())))
     if (!resource->Load(*(file.Get())))
@@ -698,7 +698,7 @@ SharedPtr<Resource> ResourceCache::GetTempResource(StringHash type, const String
             using namespace LoadFailed;
             using namespace LoadFailed;
 
 
             VariantMap& eventData = GetEventDataMap();
             VariantMap& eventData = GetEventDataMap();
-            eventData[P_RESOURCENAME] = name;
+            eventData[P_RESOURCENAME] = sanitatedName;
             SendEvent(E_LOADFAILED, eventData);
             SendEvent(E_LOADFAILED, eventData);
         }
         }
 
 
@@ -729,37 +729,37 @@ void ResourceCache::GetResources(PODVector<Resource*>& result, StringHash type)
     }
     }
 }
 }
 
 
-bool ResourceCache::Exists(const String& nameIn) const
+bool ResourceCache::Exists(const String& name) const
 {
 {
     MutexLock lock(resourceMutex_);
     MutexLock lock(resourceMutex_);
 
 
-    String name = SanitateResourceName(nameIn);
+    String sanitatedName = SanitateResourceName(name);
     if (!isRouting_)
     if (!isRouting_)
     {
     {
         isRouting_ = true;
         isRouting_ = true;
         for (unsigned i = 0; i < resourceRouters_.Size(); ++i)
         for (unsigned i = 0; i < resourceRouters_.Size(); ++i)
-            resourceRouters_[i]->Route(name, RESOURCE_CHECKEXISTS);
+            resourceRouters_[i]->Route(sanitatedName, RESOURCE_CHECKEXISTS);
         isRouting_ = false;
         isRouting_ = false;
     }
     }
 
 
-    if (name.Empty())
+    if (sanitatedName.Empty())
         return false;
         return false;
 
 
     for (unsigned i = 0; i < packages_.Size(); ++i)
     for (unsigned i = 0; i < packages_.Size(); ++i)
     {
     {
-        if (packages_[i]->Exists(name))
+        if (packages_[i]->Exists(sanitatedName))
             return true;
             return true;
     }
     }
 
 
     auto* fileSystem = GetSubsystem<FileSystem>();
     auto* fileSystem = GetSubsystem<FileSystem>();
     for (unsigned i = 0; i < resourceDirs_.Size(); ++i)
     for (unsigned i = 0; i < resourceDirs_.Size(); ++i)
     {
     {
-        if (fileSystem->FileExists(resourceDirs_[i] + name))
+        if (fileSystem->FileExists(resourceDirs_[i] + sanitatedName))
             return true;
             return true;
     }
     }
 
 
     // Fallback using absolute path
     // Fallback using absolute path
-    return fileSystem->FileExists(name);
+    return fileSystem->FileExists(sanitatedName);
 }
 }
 
 
 unsigned long long ResourceCache::GetMemoryBudget(StringHash type) const
 unsigned long long ResourceCache::GetMemoryBudget(StringHash type) const
@@ -838,18 +838,18 @@ String ResourceCache::GetPreferredResourceDir(const String& path) const
     return fixedPath;
     return fixedPath;
 }
 }
 
 
-String ResourceCache::SanitateResourceName(const String& nameIn) const
+String ResourceCache::SanitateResourceName(const String& name) const
 {
 {
     // Sanitate unsupported constructs from the resource name
     // Sanitate unsupported constructs from the resource name
-    String name = GetInternalPath(nameIn);
-    name.Replace("../", "");
-    name.Replace("./", "");
+    String sanitatedName = GetInternalPath(name);
+    sanitatedName.Replace("../", "");
+    sanitatedName.Replace("./", "");
 
 
     // If the path refers to one of the resource directories, normalize the resource name
     // If the path refers to one of the resource directories, normalize the resource name
     auto* fileSystem = GetSubsystem<FileSystem>();
     auto* fileSystem = GetSubsystem<FileSystem>();
     if (resourceDirs_.Size())
     if (resourceDirs_.Size())
     {
     {
-        String namePath = GetPath(name);
+        String namePath = GetPath(sanitatedName);
         String exePath = fileSystem->GetProgramDir().Replaced("/./", "/");
         String exePath = fileSystem->GetProgramDir().Replaced("/./", "/");
         for (unsigned i = 0; i < resourceDirs_.Size(); ++i)
         for (unsigned i = 0; i < resourceDirs_.Size(); ++i)
         {
         {
@@ -863,15 +863,15 @@ String ResourceCache::SanitateResourceName(const String& nameIn) const
                 namePath = namePath.Substring(relativeResourcePath.Length());
                 namePath = namePath.Substring(relativeResourcePath.Length());
         }
         }
 
 
-        name = namePath + GetFileNameAndExtension(name);
+        sanitatedName = namePath + GetFileNameAndExtension(sanitatedName);
     }
     }
 
 
-    return name.Trimmed();
+    return sanitatedName.Trimmed();
 }
 }
 
 
-String ResourceCache::SanitateResourceDirName(const String& nameIn) const
+String ResourceCache::SanitateResourceDirName(const String& name) const
 {
 {
-    String fixedPath = AddTrailingSlash(nameIn);
+    String fixedPath = AddTrailingSlash(name);
     if (!IsAbsolutePath(fixedPath))
     if (!IsAbsolutePath(fixedPath))
         fixedPath = GetSubsystem<FileSystem>()->GetCurrentDir() + fixedPath;
         fixedPath = GetSubsystem<FileSystem>()->GetCurrentDir() + fixedPath;
 
 
@@ -1098,34 +1098,34 @@ void ResourceCache::HandleBeginFrame(StringHash eventType, VariantMap& eventData
 #endif
 #endif
 }
 }
 
 
-File* ResourceCache::SearchResourceDirs(const String& nameIn)
+File* ResourceCache::SearchResourceDirs(const String& name)
 {
 {
     auto* fileSystem = GetSubsystem<FileSystem>();
     auto* fileSystem = GetSubsystem<FileSystem>();
     for (unsigned i = 0; i < resourceDirs_.Size(); ++i)
     for (unsigned i = 0; i < resourceDirs_.Size(); ++i)
     {
     {
-        if (fileSystem->FileExists(resourceDirs_[i] + nameIn))
+        if (fileSystem->FileExists(resourceDirs_[i] + name))
         {
         {
             // Construct the file first with full path, then rename it to not contain the resource path,
             // Construct the file first with full path, then rename it to not contain the resource path,
-            // so that the file's name can be used in further GetFile() calls (for example over the network)
-            File* file(new File(context_, resourceDirs_[i] + nameIn));
-            file->SetName(nameIn);
+            // so that the file's sanitatedName can be used in further GetFile() calls (for example over the network)
+            File* file(new File(context_, resourceDirs_[i] + name));
+            file->SetName(name);
             return file;
             return file;
         }
         }
     }
     }
 
 
     // Fallback using absolute path
     // Fallback using absolute path
-    if (fileSystem->FileExists(nameIn))
-        return new File(context_, nameIn);
+    if (fileSystem->FileExists(name))
+        return new File(context_, name);
 
 
     return nullptr;
     return nullptr;
 }
 }
 
 
-File* ResourceCache::SearchPackages(const String& nameIn)
+File* ResourceCache::SearchPackages(const String& name)
 {
 {
     for (unsigned i = 0; i < packages_.Size(); ++i)
     for (unsigned i = 0; i < packages_.Size(); ++i)
     {
     {
-        if (packages_[i]->Exists(nameIn))
-            return new File(context_, packages_[i], nameIn);
+        if (packages_[i]->Exists(name))
+            return new File(context_, packages_[i], name);
     }
     }
 
 
     return nullptr;
     return nullptr;

+ 2 - 2
Source/Urho3D/Resource/ResourceCache.h

@@ -222,9 +222,9 @@ private:
     /// Handle begin frame event. Automatic resource reloads and the finalization of background loaded resources are processed here.
     /// Handle begin frame event. Automatic resource reloads and the finalization of background loaded resources are processed here.
     void HandleBeginFrame(StringHash eventType, VariantMap& eventData);
     void HandleBeginFrame(StringHash eventType, VariantMap& eventData);
     /// Search FileSystem for file.
     /// Search FileSystem for file.
-    File* SearchResourceDirs(const String& nameIn);
+    File* SearchResourceDirs(const String& name);
     /// Search resource packages for file.
     /// Search resource packages for file.
-    File* SearchPackages(const String& nameIn);
+    File* SearchPackages(const String& name);
 
 
     /// Mutex for thread-safe access to the resource directories, resource packages and resource dependencies.
     /// Mutex for thread-safe access to the resource directories, resource packages and resource dependencies.
     mutable Mutex resourceMutex_;
     mutable Mutex resourceMutex_;

Some files were not shown because too many files changed in this diff