Browse Source

Make all vars initialized in constructors rather than at some later point.

Reported by PVS-Studio, many thanks to @alexesDev for collecting the
report.
pull/280/head
Vladimír Vondruš 8 years ago
parent
commit
e795478353
  1. 2
      src/Magnum/DebugTools/CompareImage.cpp
  2. 2
      src/Magnum/GL/Context.h
  3. 6
      src/Magnum/Platform/AbstractXApplication.h
  4. 4
      src/Magnum/Text/AbstractFont.cpp
  5. 2
      src/Magnum/Text/AbstractFont.h

2
src/Magnum/DebugTools/CompareImage.cpp

@ -412,7 +412,7 @@ namespace Corrade { namespace TestSuite {
using namespace Magnum;
Comparator<DebugTools::CompareImage>::Comparator(Float maxThreshold, Float meanThreshold): _maxThreshold{maxThreshold}, _meanThreshold{meanThreshold} {
Comparator<DebugTools::CompareImage>::Comparator(Float maxThreshold, Float meanThreshold): _maxThreshold{maxThreshold}, _meanThreshold{meanThreshold}, _max{}, _mean{} {
CORRADE_ASSERT(meanThreshold <= maxThreshold,
"DebugTools::CompareImage: maxThreshold can't be smaller than meanThreshold", );
}

2
src/Magnum/GL/Context.h

@ -656,7 +656,7 @@ class MAGNUM_GL_EXPORT Context {
MAGNUM_GL_LOCAL bool isCoreProfileImplementationNV();
#endif
void(*_functionLoader)();
void(*_functionLoader)(){};
Version _version;
#ifndef MAGNUM_TARGET_WEBGL
Flags _flags;

6
src/Magnum/Platform/AbstractXApplication.h

@ -266,9 +266,9 @@ class AbstractXApplication {
typedef Containers::EnumSet<Flag> Flags;
CORRADE_ENUMSET_FRIEND_OPERATORS(Flags)
Display* _display;
Window _window;
Atom _deleteWindow;
Display* _display{};
Window _window{};
Atom _deleteWindow{};
std::unique_ptr<Implementation::AbstractContextHandler<GLConfiguration, Display*, VisualID, Window>> _contextHandler;
std::unique_ptr<Platform::GLContext> _context;

4
src/Magnum/Text/AbstractFont.cpp

@ -56,9 +56,9 @@ std::vector<std::string> AbstractFont::pluginSearchPaths() {
}
#endif
AbstractFont::AbstractFont(): _size(0.0f) {}
AbstractFont::AbstractFont() = default;
AbstractFont::AbstractFont(PluginManager::AbstractManager& manager, const std::string& plugin): AbstractPlugin{manager, plugin}, _size{0.0f}, _lineHeight{0.0f} {}
AbstractFont::AbstractFont(PluginManager::AbstractManager& manager, const std::string& plugin): AbstractPlugin{manager, plugin} {}
bool AbstractFont::openData(const std::vector<std::pair<std::string, Containers::ArrayView<const char>>>& data, const Float size) {
CORRADE_ASSERT(features() & Feature::OpenData,

2
src/Magnum/Text/AbstractFont.h

@ -361,7 +361,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin {
#ifdef DOXYGEN_GENERATING_OUTPUT
private:
#endif
Float _size, _ascent, _descent, _lineHeight;
Float _size{}, _ascent{}, _descent{}, _lineHeight{};
};
CORRADE_ENUMSET_OPERATORS(AbstractFont::Features)

Loading…
Cancel
Save