Added readability-redundant-*, readability-simplify-* checks

Fixed CI complaints


Restored comment for clarity
This commit is contained in:
Norm Evangelista 2023-01-19 17:53:53 -08:00 committed by Chris Thrasher
parent 6ef8e487cc
commit 144b336c17
7 changed files with 10 additions and 22 deletions

View File

@ -8,6 +8,8 @@ Checks: >
readability-isolate-declaration,
readability-qualified-auto,
readability-redundant-access-specifiers,
readability-redundant-*,
readability-simplify-*,
-clang-analyzer-core.NonNullParamChecker,
-clang-analyzer-core.NullDereference,
-clang-analyzer-nullability.NullablePassedToNonnull,

View File

@ -97,10 +97,7 @@ public:
m_text.setPosition({30.f, 20.f});
// Load the shader
if (!m_shader.loadFromFile("resources/wave.vert", "resources/blur.frag"))
return false;
return true;
return m_shader.loadFromFile("resources/wave.vert", "resources/blur.frag");
}
void onUpdate(float time, float x, float y) override
@ -152,10 +149,7 @@ public:
}
// Load the shader
if (!m_shader.loadFromFile("resources/storm.vert", "resources/blink.frag"))
return false;
return true;
return m_shader.loadFromFile("resources/storm.vert", "resources/blink.frag");
}
void onUpdate(float time, float x, float y) override

View File

@ -17,7 +17,7 @@
int main()
{
// Check that the device can capture audio
if (sf::SoundRecorder::isAvailable() == false)
if (!sf::SoundRecorder::isAvailable())
{
std::cout << "Sorry, audio capture is not supported by your system" << std::endl;
return EXIT_SUCCESS;

View File

@ -195,7 +195,7 @@ bool Music::onGetData(SoundStream::Chunk& data)
// Check if we have stopped obtaining samples or reached either the EOF or the loop end point
return (data.sampleCount != 0) && (currentOffset < m_file.getSampleCount()) &&
!(currentOffset == loopEnd && m_loopSpan.length != 0);
(currentOffset != loopEnd || m_loopSpan.length == 0);
}

View File

@ -52,10 +52,8 @@ SoundBuffer::SoundBuffer()
////////////////////////////////////////////////////////////
SoundBuffer::SoundBuffer(const SoundBuffer& copy) :
m_samples(copy.m_samples),
m_duration(copy.m_duration),
m_sounds() // don't copy the attached sounds
SoundBuffer::SoundBuffer(const SoundBuffer& copy) : m_samples(copy.m_samples), m_duration(copy.m_duration)
// don't copy the attached sounds
{
// Create the buffer
alCheck(alGenBuffers(1, &m_buffer));

View File

@ -72,10 +72,7 @@ bool isActive(std::uint64_t id)
{
auto it = contextRenderTargetMap.find(sf::Context::getActiveContextId());
if ((it == contextRenderTargetMap.end()) || (it->second != id))
return false;
return true;
return (it != contextRenderTargetMap.end()) && (it->second == id);
}
// Convert an sf::BlendMode::Factor constant to the corresponding OpenGL constant.

View File

@ -256,10 +256,7 @@ bool VertexBuffer::update([[maybe_unused]] const VertexBuffer& vertexBuffer)
glCheck(GLEXT_glBindBuffer(GLEXT_GL_ARRAY_BUFFER, 0));
if ((sourceResult == GL_FALSE) || (destinationResult == GL_FALSE))
return false;
return true;
return (sourceResult == GL_TRUE) && (destinationResult == GL_TRUE);
#endif // SFML_OPENGL_ES
}