浏览代码

Remove casts around nullptr.

Eugene Kozlov 8 年之前
父节点
当前提交
de249a1963
共有 36 个文件被更改,包括 67 次插入67 次删除
  1. 1 1
      Source/Urho3D/AngelScript/GraphicsAPI.cpp
  2. 2 2
      Source/Urho3D/Core/Context.h
  3. 1 1
      Source/Urho3D/Core/Variant.h
  4. 6 6
      Source/Urho3D/Graphics/Animation.cpp
  5. 1 1
      Source/Urho3D/Graphics/Batch.cpp
  6. 1 1
      Source/Urho3D/Graphics/BillboardSet.cpp
  7. 3 3
      Source/Urho3D/Graphics/CustomGeometry.cpp
  8. 5 5
      Source/Urho3D/Graphics/DecalSet.cpp
  9. 1 1
      Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp
  10. 1 1
      Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp
  11. 1 1
      Source/Urho3D/Graphics/Drawable.cpp
  12. 1 1
      Source/Urho3D/Graphics/Geometry.cpp
  13. 1 1
      Source/Urho3D/Graphics/IndexBuffer.cpp
  14. 3 3
      Source/Urho3D/Graphics/Material.cpp
  15. 1 1
      Source/Urho3D/Graphics/OcclusionBuffer.h
  16. 1 1
      Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp
  17. 2 2
      Source/Urho3D/Graphics/ParticleEffect.cpp
  18. 1 1
      Source/Urho3D/Graphics/RenderPath.h
  19. 1 1
      Source/Urho3D/Graphics/RenderSurface.cpp
  20. 2 2
      Source/Urho3D/Graphics/Renderer.cpp
  21. 1 1
      Source/Urho3D/Graphics/Renderer.h
  22. 1 1
      Source/Urho3D/Graphics/Skeleton.cpp
  23. 2 2
      Source/Urho3D/Graphics/StaticModel.cpp
  24. 1 1
      Source/Urho3D/Graphics/StaticModelGroup.cpp
  25. 9 9
      Source/Urho3D/Graphics/Terrain.cpp
  26. 1 1
      Source/Urho3D/Graphics/VertexBuffer.cpp
  27. 4 4
      Source/Urho3D/Graphics/View.cpp
  28. 1 1
      Source/Urho3D/Navigation/NavigationMesh.cpp
  29. 1 1
      Source/Urho3D/Navigation/OffMeshConnection.cpp
  30. 2 2
      Source/Urho3D/Physics/PhysicsWorld.cpp
  31. 1 1
      Source/Urho3D/Resource/ResourceCache.cpp
  32. 2 2
      Source/Urho3D/UI/Text.cpp
  33. 2 2
      Source/Urho3D/UI/Text3D.cpp
  34. 1 1
      Source/Urho3D/UI/UI.cpp
  35. 1 1
      Source/Urho3D/UI/UIElement.cpp
  36. 1 1
      Source/Urho3D/Urho2D/Constraint2D.cpp

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

@@ -1430,7 +1430,7 @@ static unsigned AnimationControllerGetNumAnimations(AnimationController* control
 static const AnimationControl* AnimationControllerGetAnimation(unsigned index, AnimationController* controller)
 {
     const Vector<AnimationControl>& animations = controller->GetAnimations();
-    return (index < animations.Size()) ? &animations[index] : (const AnimationControl*)nullptr;
+    return (index < animations.Size()) ? &animations[index] : nullptr;
 }
 
 static void RegisterAnimationController(asIScriptEngine* engine)

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

@@ -184,7 +184,7 @@ public:
         if (i != specificEventReceivers_.End())
         {
             HashMap<StringHash, SharedPtr<EventReceiverGroup> >::Iterator j = i->second_.Find(eventType);
-            return j != i->second_.End() ? j->second_ : (EventReceiverGroup*)nullptr;
+            return j != i->second_.End() ? j->second_ : nullptr;
         }
         else
             return nullptr;
@@ -194,7 +194,7 @@ public:
     EventReceiverGroup* GetEventReceivers(StringHash eventType)
     {
         HashMap<StringHash, SharedPtr<EventReceiverGroup> >::Iterator i = eventReceivers_.Find(eventType);
-        return i != eventReceivers_.End() ? i->second_ : (EventReceiverGroup*)nullptr;
+        return i != eventReceivers_.End() ? i->second_ : nullptr;
     }
 
 private:

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

@@ -1272,7 +1272,7 @@ public:
     /// Return a RefCounted pointer or null on type mismatch. Will return null if holding a void pointer, as it can not be safely verified that the object is a RefCounted.
     RefCounted* GetPtr() const
     {
-        return type_ == VAR_PTR ? value_.weakPtr_ : (RefCounted*)nullptr;
+        return type_ == VAR_PTR ? value_.weakPtr_ : nullptr;
     }
 
     /// Return a Matrix3 or identity on type mismatch.

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

@@ -86,7 +86,7 @@ void AnimationTrack::RemoveAllKeyFrames()
 
 AnimationKeyFrame* AnimationTrack::GetKeyFrame(unsigned index)
 {
-    return index < keyFrames_.Size() ? &keyFrames_[index] : (AnimationKeyFrame*)nullptr;
+    return index < keyFrames_.Size() ? &keyFrames_[index] : nullptr;
 }
 
 void AnimationTrack::GetKeyFrameIndex(float time, unsigned& index) const
@@ -386,7 +386,7 @@ SharedPtr<Animation> Animation::Clone(const String& cloneName) const
 AnimationTrack* Animation::GetTrack(unsigned index)
 {
     if (index >= GetNumTracks())
-        return (AnimationTrack*) nullptr;
+        return nullptr;
 
     int j = 0;
     for(HashMap<StringHash, AnimationTrack>::Iterator i = tracks_.Begin(); i != tracks_.End(); ++i)
@@ -397,24 +397,24 @@ AnimationTrack* Animation::GetTrack(unsigned index)
         ++j;
     }
 
-    return (AnimationTrack*) nullptr;
+    return nullptr;
 }
 
 AnimationTrack* Animation::GetTrack(const String& name)
 {
     HashMap<StringHash, AnimationTrack>::Iterator i = tracks_.Find(StringHash(name));
-    return i != tracks_.End() ? &i->second_ : (AnimationTrack*)nullptr;
+    return i != tracks_.End() ? &i->second_ : nullptr;
 }
 
 AnimationTrack* Animation::GetTrack(StringHash nameHash)
 {
     HashMap<StringHash, AnimationTrack>::Iterator i = tracks_.Find(nameHash);
-    return i != tracks_.End() ? &i->second_ : (AnimationTrack*)nullptr;
+    return i != tracks_.End() ? &i->second_ : nullptr;
 }
 
 AnimationTriggerPoint* Animation::GetTrigger(unsigned index)
 {
-    return index < triggers_.Size() ? &triggers_[index] : (AnimationTriggerPoint*)nullptr;
+    return index < triggers_.Size() ? &triggers_[index] : nullptr;
 }
 
 }

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

@@ -224,7 +224,7 @@ void Batch::Prepare(View* view, Camera* camera, bool setModelTransform, bool all
     }
 
     // Set global (per-frame) shader parameters
-    if (graphics->NeedParameterUpdate(SP_FRAME, (void*)nullptr))
+    if (graphics->NeedParameterUpdate(SP_FRAME, nullptr))
         view->SetGlobalShaderParameters();
 
     // Set camera & viewport shader parameters

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

@@ -358,7 +358,7 @@ Material* BillboardSet::GetMaterial() const
 
 Billboard* BillboardSet::GetBillboard(unsigned index)
 {
-    return index < billboards_.Size() ? &billboards_[index] : (Billboard*)nullptr;
+    return index < billboards_.Size() ? &billboards_[index] : nullptr;
 }
 
 void BillboardSet::SetMaterialAttr(const ResourceRef& value)

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

@@ -139,7 +139,7 @@ void CustomGeometry::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQ
 
 Geometry* CustomGeometry::GetLodGeometry(unsigned batchIndex, unsigned level)
 {
-    return batchIndex < geometries_.Size() ? geometries_[batchIndex] : (Geometry*)nullptr;
+    return batchIndex < geometries_.Size() ? geometries_[batchIndex] : nullptr;
 }
 
 unsigned CustomGeometry::GetNumOccluderTriangles()
@@ -439,13 +439,13 @@ unsigned CustomGeometry::GetNumVertices(unsigned index) const
 
 Material* CustomGeometry::GetMaterial(unsigned index) const
 {
-    return index < batches_.Size() ? batches_[index].material_ : (Material*)nullptr;
+    return index < batches_.Size() ? batches_[index].material_ : nullptr;
 }
 
 CustomGeometryVertex* CustomGeometry::GetVertex(unsigned geometryIndex, unsigned vertexNum)
 {
     return (geometryIndex < vertices_.Size() && vertexNum < vertices_[geometryIndex].Size()) ?
-           &vertices_[geometryIndex][vertexNum] : (CustomGeometryVertex*)nullptr;
+           &vertices_[geometryIndex][vertexNum] : nullptr;
 }
 
 void CustomGeometry::SetGeometryDataAttr(const PODVector<unsigned char>& value)

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

@@ -834,9 +834,9 @@ void DecalSet::GetFace(Vector<PODVector<DecalVertex> >& faces, Drawable* target,
     const Vector3& n1 = hasNormals ? *((const Vector3*)(&normalData[i1 * normalStride])) : faceNormal;
     const Vector3& n2 = hasNormals ? *((const Vector3*)(&normalData[i2 * normalStride])) : faceNormal;
 
-    const unsigned char* s0 = hasSkinning ? &skinningData[i0 * skinningStride] : (const unsigned char*)nullptr;
-    const unsigned char* s1 = hasSkinning ? &skinningData[i1 * skinningStride] : (const unsigned char*)nullptr;
-    const unsigned char* s2 = hasSkinning ? &skinningData[i2 * skinningStride] : (const unsigned char*)nullptr;
+    const unsigned char* s0 = hasSkinning ? &skinningData[i0 * skinningStride] : nullptr;
+    const unsigned char* s1 = hasSkinning ? &skinningData[i1 * skinningStride] : nullptr;
+    const unsigned char* s2 = hasSkinning ? &skinningData[i2 * skinningStride] : nullptr;
 
     // Check if face is too much away from the decal normal
     if (decalNormal.DotProduct((n0 + n1 + n2) / 3.0f) < normalCutoff)
@@ -1023,8 +1023,8 @@ void DecalSet::UpdateBuffers()
     geometry_->SetVertexBuffer(0, vertexBuffer_);
     geometry_->SetDrawRange(TRIANGLE_LIST, 0, numIndices_, 0, numVertices_);
     
-    float* vertices = numVertices_ ? (float*)vertexBuffer_->Lock(0, numVertices_) : (float*)nullptr;
-    unsigned short* indices = numIndices_ ? (unsigned short*)indexBuffer_->Lock(0, numIndices_) : (unsigned short*)nullptr;
+    float* vertices = numVertices_ ? (float*)vertexBuffer_->Lock(0, numVertices_) : nullptr;
+    unsigned short* indices = numIndices_ ? (unsigned short*)indexBuffer_->Lock(0, numIndices_) : nullptr;
 
     if (vertices && indices)
     {

+ 1 - 1
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -1769,7 +1769,7 @@ ShaderVariation* Graphics::GetShader(ShaderType type, const char* name, const ch
         lastShaderName_ = name;
     }
 
-    return lastShader_ ? lastShader_->GetVariation(type, defines) : (ShaderVariation*)nullptr;
+    return lastShader_ ? lastShader_->GetVariation(type, defines) : nullptr;
 }
 
 VertexBuffer* Graphics::GetVertexBuffer(unsigned index) const

+ 1 - 1
Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -2026,7 +2026,7 @@ ShaderVariation* Graphics::GetShader(ShaderType type, const char* name, const ch
         lastShaderName_ = name;
     }
 
-    return lastShader_ ? lastShader_->GetVariation(type, defines) : (ShaderVariation*)nullptr;
+    return lastShader_ ? lastShader_->GetVariation(type, defines) : nullptr;
 }
 
 VertexBuffer* Graphics::GetVertexBuffer(unsigned index) const

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

@@ -52,7 +52,7 @@ SourceBatch::SourceBatch() :
     geometry_(nullptr),
     worldTransform_(&Matrix3x4::IDENTITY),
     numWorldTransforms_(1),
-    instancingData_((void*)nullptr),
+    instancingData_(nullptr),
     geometryType_(GEOM_STATIC)
 {
 }

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

@@ -192,7 +192,7 @@ void Geometry::Draw(Graphics* graphics)
 
 VertexBuffer* Geometry::GetVertexBuffer(unsigned index) const
 {
-    return index < vertexBuffers_.Size() ? vertexBuffers_[index] : (VertexBuffer*)nullptr;
+    return index < vertexBuffers_.Size() ? vertexBuffers_[index] : nullptr;
 }
 
 unsigned short Geometry::GetBufferHash() const

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

@@ -35,7 +35,7 @@ namespace Urho3D
 
 IndexBuffer::IndexBuffer(Context* context, bool forceHeadless) :
     Object(context),
-    GPUObject(forceHeadless ? (Graphics*)nullptr : GetSubsystem<Graphics>()),
+    GPUObject(forceHeadless ? nullptr : GetSubsystem<Graphics>()),
     indexCount_(0),
     indexSize_(0),
     lockState_(LOCK_NONE),

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

@@ -1205,19 +1205,19 @@ const TechniqueEntry& Material::GetTechniqueEntry(unsigned index) const
 
 Technique* Material::GetTechnique(unsigned index) const
 {
-    return index < techniques_.Size() ? techniques_[index].technique_ : (Technique*)nullptr;
+    return index < techniques_.Size() ? techniques_[index].technique_ : nullptr;
 }
 
 Pass* Material::GetPass(unsigned index, const String& passName) const
 {
-    Technique* tech = index < techniques_.Size() ? techniques_[index].technique_ : (Technique*)nullptr;
+    Technique* tech = index < techniques_.Size() ? techniques_[index].technique_ : nullptr;
     return tech ? tech->GetPass(passName) : nullptr;
 }
 
 Texture* Material::GetTexture(TextureUnit unit) const
 {
     HashMap<TextureUnit, SharedPtr<Texture> >::ConstIterator i = textures_.Find(unit);
-    return i != textures_.End() ? i->second_.Get() : (Texture*)nullptr;
+    return i != textures_.End() ? i->second_.Get() : nullptr;
 }
 
 const Variant& Material::GetShaderParameter(const String& name) const

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

@@ -121,7 +121,7 @@ public:
     void ResetUseTimer();
 
     /// Return highest level depth values.
-    int* GetBuffer() const { return buffers_.Size() ? buffers_[0].data_ : (int*)nullptr; }
+    int* GetBuffer() const { return buffers_.Size() ? buffers_[0].data_ : nullptr; }
 
     /// Return view transform matrix.
     const Matrix3x4& GetView() const { return view_; }

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

@@ -2186,7 +2186,7 @@ ShaderVariation* Graphics::GetShader(ShaderType type, const char* name, const ch
         lastShaderName_ = name;
     }
 
-    return lastShader_ ? lastShader_->GetVariation(type, defines) : (ShaderVariation*)nullptr;
+    return lastShader_ ? lastShader_->GetVariation(type, defines) : nullptr;
 }
 
 VertexBuffer* Graphics::GetVertexBuffer(unsigned index) const

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

@@ -778,12 +778,12 @@ SharedPtr<ParticleEffect> ParticleEffect::Clone(const String& cloneName) const
 
 const ColorFrame* ParticleEffect::GetColorFrame(unsigned index) const
 {
-    return index < colorFrames_.Size() ? &colorFrames_[index] : (ColorFrame*)nullptr;
+    return index < colorFrames_.Size() ? &colorFrames_[index] : nullptr;
 }
 
 const TextureFrame* ParticleEffect::GetTextureFrame(unsigned index) const
 {
-    return index < textureFrames_.Size() ? &textureFrames_[index] : (TextureFrame*)nullptr;
+    return index < textureFrames_.Size() ? &textureFrames_[index] : nullptr;
 }
 
 Vector3 ParticleEffect::GetRandomDirection() const

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

@@ -259,7 +259,7 @@ public:
     unsigned GetNumCommands() const { return commands_.Size(); }
 
     /// Return command at index, or null if does not exist.
-    RenderPathCommand* GetCommand(unsigned index) { return index < commands_.Size() ? &commands_[index] : (RenderPathCommand*)nullptr; }
+    RenderPathCommand* GetCommand(unsigned index) { return index < commands_.Size() ? &commands_[index] : nullptr; }
 
     /// Return a shader parameter (first appearance in any command.)
     const Variant& GetShaderParameter(const String& name) const;

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

@@ -106,7 +106,7 @@ bool RenderSurface::GetAutoResolve() const
 
 Viewport* RenderSurface::GetViewport(unsigned index) const
 {
-    return index < viewports_.Size() ? viewports_[index] : (Viewport*)nullptr;
+    return index < viewports_.Size() ? viewports_[index] : nullptr;
 }
 
 }

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

@@ -571,7 +571,7 @@ void Renderer::ApplyShadowMapFilter(View* view, Texture2D* shadowMap, float blur
 
 Viewport* Renderer::GetViewport(unsigned index) const
 {
-    return index < viewports_.Size() ? viewports_[index] : (Viewport*)nullptr;
+    return index < viewports_.Size() ? viewports_[index] : nullptr;
 }
 
 Viewport* Renderer::GetViewportForScene(Scene* scene, unsigned index) const
@@ -1183,7 +1183,7 @@ void Renderer::StorePreparedView(View* view, Camera* camera)
 View* Renderer::GetPreparedView(Camera* camera)
 {
     HashMap<Camera*, WeakPtr<View> >::Iterator i = preparedViews_.Find(camera);
-    return i != preparedViews_.End() ? i->second_ : (View*)nullptr;
+    return i != preparedViews_.End() ? i->second_ : nullptr;
 }
 
 View* Renderer::GetActualView(View* view)

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

@@ -374,7 +374,7 @@ public:
     TextureCube* GetIndirectionCubeMap() const { return indirectionCubeMap_; }
 
     /// Return the instancing vertex buffer
-    VertexBuffer* GetInstancingBuffer() const { return dynamicInstancing_ ? instancingBuffer_ : (VertexBuffer*)nullptr; }
+    VertexBuffer* GetInstancingBuffer() const { return dynamicInstancing_ ? instancingBuffer_.Get() : nullptr; }
 
     /// Return the frame update parameters.
     const FrameInfo& GetFrameInfo() const { return frame_; }

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

@@ -154,7 +154,7 @@ Bone* Skeleton::GetRootBone()
 
 Bone* Skeleton::GetBone(unsigned index)
 {
-    return index < bones_.Size() ? &bones_[index] : (Bone*)nullptr;
+    return index < bones_.Size() ? &bones_[index] : nullptr;
 }
 
 Bone* Skeleton::GetBone(const String& name)

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

@@ -254,7 +254,7 @@ void StaticModel::SetModel(Model* model)
         SetNumGeometries(model->GetNumGeometries());
         const Vector<Vector<SharedPtr<Geometry> > >& geometries = model->GetGeometries();
         const PODVector<Vector3>& geometryCenters = model->GetGeometryCenters();
-        const Matrix3x4* worldTransform = node_ ? &node_->GetWorldTransform() : (const Matrix3x4*)nullptr;
+        const Matrix3x4* worldTransform = node_ ? &node_->GetWorldTransform() : nullptr;
         for (unsigned i = 0; i < geometries.Size(); ++i)
         {
             batches_[i].worldTransform_ = worldTransform;
@@ -325,7 +325,7 @@ void StaticModel::ApplyMaterialList(const String& fileName)
 
 Material* StaticModel::GetMaterial(unsigned index) const
 {
-    return index < batches_.Size() ? batches_[index].material_ : (Material*)nullptr;
+    return index < batches_.Size() ? batches_[index].material_ : nullptr;
 }
 
 bool StaticModel::IsInside(const Vector3& point) const

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

@@ -319,7 +319,7 @@ void StaticModelGroup::RemoveAllInstanceNodes()
 
 Node* StaticModelGroup::GetInstanceNode(unsigned index) const
 {
-    return index < instanceNodes_.Size() ? instanceNodes_[index] : (Node*)nullptr;
+    return index < instanceNodes_.Size() ? instanceNodes_[index] : nullptr;
 }
 
 void StaticModelGroup::SetNodeIDsAttr(const VariantVector& value)

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

@@ -172,14 +172,14 @@ void Terrain::ApplyAttributes()
     if (neighborsDirty_)
     {
         Scene* scene = GetScene();
-        Node* north = scene ? scene->GetNode(northID_) : (Node*)nullptr;
-        Node* south = scene ? scene->GetNode(southID_) : (Node*)nullptr;
-        Node* west = scene ? scene->GetNode(westID_) : (Node*)nullptr;
-        Node* east = scene ? scene->GetNode(eastID_) : (Node*)nullptr;
-        Terrain* northTerrain = north ? north->GetComponent<Terrain>() : (Terrain*)nullptr;
-        Terrain* southTerrain = south ? south->GetComponent<Terrain>() : (Terrain*)nullptr;
-        Terrain* westTerrain = west ? west->GetComponent<Terrain>() : (Terrain*)nullptr;
-        Terrain* eastTerrain = east ? east->GetComponent<Terrain>() : (Terrain*)nullptr;
+        Node* north = scene ? scene->GetNode(northID_) : nullptr;
+        Node* south = scene ? scene->GetNode(southID_) : nullptr;
+        Node* west = scene ? scene->GetNode(westID_) : nullptr;
+        Node* east = scene ? scene->GetNode(eastID_) : nullptr;
+        Terrain* northTerrain = north ? north->GetComponent<Terrain>() : nullptr;
+        Terrain* southTerrain = south ? south->GetComponent<Terrain>() : nullptr;
+        Terrain* westTerrain = west ? west->GetComponent<Terrain>() : nullptr;
+        Terrain* eastTerrain = east ? east->GetComponent<Terrain>() : nullptr;
         SetNeighbors(northTerrain, southTerrain, westTerrain, eastTerrain);
         neighborsDirty_ = false;
     }
@@ -543,7 +543,7 @@ Material* Terrain::GetMaterial() const
 
 TerrainPatch* Terrain::GetPatch(unsigned index) const
 {
-    return index < patches_.Size() ? patches_[index] : (TerrainPatch*)nullptr;
+    return index < patches_.Size() ? patches_[index] : nullptr;
 }
 
 TerrainPatch* Terrain::GetPatch(int x, int z) const

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

@@ -35,7 +35,7 @@ namespace Urho3D
 
 VertexBuffer::VertexBuffer(Context* context, bool forceHeadless) :
     Object(context),
-    GPUObject(forceHeadless ? (Graphics*)nullptr : GetSubsystem<Graphics>()),
+    GPUObject(forceHeadless ? nullptr : GetSubsystem<Graphics>()),
     vertexCount_(0),
     elementMask_(0),
     lockState_(LOCK_NONE),

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

@@ -1019,7 +1019,7 @@ void View::ProcessLights()
 
 void View::GetLightBatches()
 {
-    BatchQueue* alphaQueue = batchQueues_.Contains(alphaPassIndex_) ? &batchQueues_[alphaPassIndex_] : (BatchQueue*)nullptr;
+    BatchQueue* alphaQueue = batchQueues_.Contains(alphaPassIndex_) ? &batchQueues_[alphaPassIndex_] : nullptr;
 
     // Build light queues and lit batches
     {
@@ -2074,11 +2074,11 @@ void View::AllocateScreenBuffers()
     int multiSample = renderTarget_ ? renderTarget_->GetMultiSample() : graphics_->GetMultiSample();
     bool autoResolve = renderTarget_ ? renderTarget_->GetAutoResolve() : true;
     substituteRenderTarget_ = needSubstitute ? GetRenderSurfaceFromTexture(renderer_->GetScreenBuffer(viewSize_.x_, viewSize_.y_,
-        format, multiSample, autoResolve, false, true, sRGB)) : (RenderSurface*)nullptr;
+        format, multiSample, autoResolve, false, true, sRGB)) : nullptr;
     for (unsigned i = 0; i < MAX_VIEWPORT_TEXTURES; ++i)
     {
         viewportTextures_[i] = i < numViewportTextures ? renderer_->GetScreenBuffer(viewSize_.x_, viewSize_.y_, format, multiSample,
-            autoResolve, false, true, sRGB) : (Texture*)nullptr;
+            autoResolve, false, true, sRGB) : nullptr;
     }
     // If using a substitute render target and pingponging, the substitute can act as the second viewport texture
     if (numViewportTextures == 1 && substituteRenderTarget_)
@@ -2849,7 +2849,7 @@ Technique* View::GetTechnique(Drawable* drawable, Material* material)
         }
 
         // If no suitable technique found, fallback to the last
-        return techniques.Size() ? techniques.Back().technique_ : (Technique*)nullptr;
+        return techniques.Size() ? techniques.Back().technique_ : nullptr;
     }
 }
 

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

@@ -646,7 +646,7 @@ Vector3 NavigationMesh::MoveAlongSurface(const Vector3& start, const Vector3& en
     maxVisited = Max(maxVisited, 0);
     PODVector<dtPolyRef> visited((unsigned)maxVisited);
     navMeshQuery_->moveAlongSurface(startRef, &localStart.x_, &localEnd.x_, queryFilter, &resultPos.x_, maxVisited ?
-        &visited[0] : (dtPolyRef*)nullptr, &visitedCount, maxVisited);
+        &visited[0] : nullptr, &visitedCount, maxVisited);
     return transform * resultPos;
 }
 

+ 1 - 1
Source/Urho3D/Navigation/OffMeshConnection.cpp

@@ -78,7 +78,7 @@ void OffMeshConnection::ApplyAttributes()
     if (endPointDirty_)
     {
         Scene* scene = GetScene();
-        endPoint_ = scene ? scene->GetNode(endPointID_) : (Node*)nullptr;
+        endPoint_ = scene ? scene->GetNode(endPointID_) : nullptr;
         endPointDirty_ = false;
     }
 }

+ 2 - 2
Source/Urho3D/Physics/PhysicsWorld.cpp

@@ -511,8 +511,8 @@ void PhysicsWorld::ConvexCast(PhysicsRaycastResult& result, CollisionShape* shap
 
     // If shape is attached in a rigidbody, set its collision group temporarily to 0 to make sure it is not returned in the sweep result
     RigidBody* bodyComp = shape->GetComponent<RigidBody>();
-    btRigidBody* body = bodyComp ? bodyComp->GetBody() : (btRigidBody*)nullptr;
-    btBroadphaseProxy* proxy = body ? body->getBroadphaseProxy() : (btBroadphaseProxy*)nullptr;
+    btRigidBody* body = bodyComp ? bodyComp->GetBody() : nullptr;
+    btBroadphaseProxy* proxy = body ? body->getBroadphaseProxy() : nullptr;
     short group = 0;
     if (proxy)
     {

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

@@ -799,7 +799,7 @@ String ResourceCache::GetResourceFileName(const String& name) const
 
 ResourceRouter* ResourceCache::GetResourceRouter(unsigned index) const
 {
-    return index < resourceRouters_.Size() ? resourceRouters_[index] : (ResourceRouter*)nullptr;
+    return index < resourceRouters_.Size() ? resourceRouters_[index] : nullptr;
 }
 
 String ResourceCache::GetPreferredResourceDir(const String& path) const

+ 2 - 2
Source/Urho3D/UI/Text.cpp

@@ -125,7 +125,7 @@ void Text::ApplyAttributes()
 
 void Text::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
 {
-    FontFace* face = font_ ? font_->GetFace(fontSize_) : (FontFace*)nullptr;
+    FontFace* face = font_ ? font_->GetFace(fontSize_) : nullptr;
     if (!face)
     {
         hovering_ = false;
@@ -706,7 +706,7 @@ void Text::UpdateText(bool onResize)
 void Text::UpdateCharLocations()
 {
     // Remember the font face to see if it's still valid when it's time to render
-    FontFace* face = font_ ? font_->GetFace(fontSize_) : (FontFace*)nullptr;
+    FontFace* face = font_ ? font_->GetFace(fontSize_) : nullptr;
     if (!face)
         return;
     fontFace_ = face;

+ 2 - 2
Source/Urho3D/UI/Text3D.cpp

@@ -676,7 +676,7 @@ void Text3D::UpdateTextMaterials(bool forceUpdate)
             if (!material_)
             {
                 Technique* tech = material->GetTechnique(0);
-                Pass* pass = tech ? tech->GetPass("alpha") : (Pass*)nullptr;
+                Pass* pass = tech ? tech->GetPass("alpha") : nullptr;
                 if (pass)
                 {
                     switch (GetTextEffect())
@@ -721,7 +721,7 @@ void Text3D::UpdateTextMaterials(bool forceUpdate)
             if (!material_)
             {
                 Technique* tech = material->GetTechnique(0);
-                Pass* pass = tech ? tech->GetPass("alpha") : (Pass*)nullptr;
+                Pass* pass = tech ? tech->GetPass("alpha") : nullptr;
                 if (pass)
                 {
                     if (texture && texture->GetFormat() == Graphics::GetAlphaFormat())

+ 1 - 1
Source/Urho3D/UI/UI.cpp

@@ -883,7 +883,7 @@ UIElement* UI::GetDragElement(unsigned index)
 {
     GetDragElements();
     if (index >= dragElementsConfirmed_.Size())
-        return (UIElement*)nullptr;
+        return nullptr;
 
     return dragElementsConfirmed_[index];
 }

+ 1 - 1
Source/Urho3D/UI/UIElement.cpp

@@ -1653,7 +1653,7 @@ unsigned UIElement::GetNumChildren(bool recursive) const
 
 UIElement* UIElement::GetChild(unsigned index) const
 {
-    return index < children_.Size() ? children_[index] : (UIElement*)nullptr;
+    return index < children_.Size() ? children_[index] : nullptr;
 }
 
 UIElement* UIElement::GetChild(const String& name, bool recursive) const

+ 1 - 1
Source/Urho3D/Urho2D/Constraint2D.cpp

@@ -133,7 +133,7 @@ void Constraint2D::SetOtherBody(RigidBody2D* body)
 
     otherBody_ = body;
 
-    Node* otherNode = body ? body->GetNode() : (Node*)nullptr;
+    Node* otherNode = body ? body->GetNode() : nullptr;
     otherBodyNodeID_ = otherNode ? otherNode->GetID() : 0;
 
     RecreateJoint();