Skip to content

Commit 47fcc78

Browse files
ntfshardiche033
authored andcommitted
CppCheck fixes (#1148)
Signed-off-by: Maksim Derbasov <[email protected]> (cherry picked from commit ff4cb13)
1 parent 8ef1995 commit 47fcc78

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ gz_find_package(GzOGRE VERSION 1.9.0
8888
REQUIRED_BY ogre
8989
PRIVATE_FOR ogre)
9090

91-
# Ogre versions greater than 1.9.x are not officialy supported.
91+
# Ogre versions greater than 1.9.x are not officially supported.
9292
# Display a warning for the users on this setup unless they provide
9393
# USE_UNOFFICIAL_OGRE_VERSIONS flag
9494
if (NOT USE_UNOFFICIAL_OGRE_VERSIONS)
9595
if (OGRE_VERSION VERSION_GREATER_EQUAL 1.10.0)
9696
GZ_BUILD_WARNING("Ogre 1.x versions greater than 1.9 are not officially supported."
97-
"The software might compile and even work but support from upstream"
98-
"could be reduced to accepting patches for newer versions")
97+
"The software might compile and even work but support from upstream"
98+
"could be reduced to accepting patches for newer versions")
9999
endif()
100100
endif()
101101

examples/lux_core_engine/LuxCoreEngineMeshFactory.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,27 @@ LuxCoreEngineMeshFactory::Create(const MeshDescriptor &_desc,
4444

4545
struct Coordinate
4646
{
47-
float x, y;
47+
float x{}, y{};
4848

4949
Coordinate(float x, float y) : x(x), y(y) {}
50-
Coordinate() {}
50+
Coordinate() = default;
5151
};
5252

5353
struct Vertex
5454
{
55-
float x, y, z;
55+
float x{}, y{}, z{};
5656

5757
Vertex(float x, float y, float z) : x(x), y(y), z(z) {}
58-
Vertex() {}
58+
Vertex() = default;
5959
};
6060

6161
struct VertexTriangle
6262
{
63-
unsigned int v1, v2, v3;
63+
unsigned int v1{}, v2{}, v3{};
6464

6565
VertexTriangle(unsigned int v1, unsigned int v2, unsigned int v3)
6666
: v1(v1), v2(v2), v3(v3) {}
67-
VertexTriangle() {}
67+
VertexTriangle() = default;
6868
};
6969

7070
if (_desc.meshName == "unit_box")

examples/visualization_demo/GlutWindow.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define NOMINMAX
2424
// Must include this before GL/gl.h
2525
#include <windows.h>
26-
#include <GL/glew.h
26+
#include <GL/glew.h>
2727
// OpenGL utilities header file
2828
#include <GL/glu.h>
2929
// OpenGL utilities header file

ogre/src/OgreCamera.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ void OgreCamera::SyncOgreCameraAspectRatio()
164164
void OgreCamera::CreateCamera()
165165
{
166166
// create ogre camera object
167-
Ogre::SceneManager *ogreSceneManager;
168-
ogreSceneManager = this->scene->OgreSceneManager();
167+
Ogre::SceneManager *ogreSceneManager = this->scene->OgreSceneManager();
169168
if (ogreSceneManager == nullptr)
170169
{
171170
gzerr << "Scene manager cannot be obtained" << std::endl;
171+
return;
172172
}
173173

174174
this->ogreCamera = ogreSceneManager->createCamera(this->name);

ogre/src/OgreRenderEngine.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,6 @@ void OgreRenderEngine::LoadPlugins()
479479
//////////////////////////////////////////////////
480480
void OgreRenderEngine::CreateRenderSystem()
481481
{
482-
Ogre::RenderSystem *renderSys;
483482
const Ogre::RenderSystemList *rsList;
484483

485484
// Set parameters of render system (window size, etc.)
@@ -491,7 +490,7 @@ void OgreRenderEngine::CreateRenderSystem()
491490

492491
int c = 0;
493492

494-
renderSys = nullptr;
493+
Ogre::RenderSystem *renderSys = nullptr;
495494

496495
do
497496
{
@@ -512,6 +511,7 @@ void OgreRenderEngine::CreateRenderSystem()
512511
gzerr << "unable to find OpenGL rendering system. OGRE is probably "
513512
"installed incorrectly. Double check the OGRE cmake output, "
514513
"and make sure OpenGL is enabled." << std::endl;
514+
return;
515515
}
516516

517517
// We operate in windowed mode

ogre2/src/Ogre2Camera.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,18 @@ void Ogre2Camera::Destroy()
6161
this->RemoveAllRenderPasses();
6262
this->DestroyRenderTexture();
6363

64-
Ogre::SceneManager *ogreSceneManager;
65-
ogreSceneManager = this->scene->OgreSceneManager();
64+
Ogre::SceneManager *ogreSceneManager = this->scene->OgreSceneManager();
6665
if (ogreSceneManager == nullptr)
6766
{
6867
gzerr << "Scene manager cannot be obtained" << std::endl;
6968
}
70-
if (ogreSceneManager->findCameraNoThrow(this->name) != nullptr)
69+
else
7170
{
72-
ogreSceneManager->destroyCamera(this->ogreCamera);
73-
this->ogreCamera = nullptr;
71+
if (ogreSceneManager->findCameraNoThrow(this->name) != nullptr)
72+
{
73+
ogreSceneManager->destroyCamera(this->ogreCamera);
74+
this->ogreCamera = nullptr;
75+
}
7476
}
7577

7678
if (this->selectionBuffer)

0 commit comments

Comments
 (0)