Browse Source

More compiler warnings fixing

Signed-off-by: falkTX <falktx@falktx.com>
pull/330/head
falkTX 3 years ago
parent
commit
1adef358f4
8 changed files with 33 additions and 12 deletions
  1. +11
    -2
      dgl/EventHandlers.hpp
  2. +8
    -0
      dgl/NanoVG.hpp
  3. +2
    -2
      dgl/src/Color.cpp
  4. +5
    -3
      dgl/src/Geometry.cpp
  5. +1
    -1
      dgl/src/OpenGL.cpp
  6. +3
    -1
      dgl/src/SubWidget.cpp
  7. +2
    -2
      dgl/src/Window.cpp
  8. +1
    -1
      distrho/src/DistrhoPluginInternal.hpp

+ 11
- 2
dgl/EventHandlers.hpp View File

@@ -52,7 +52,7 @@ public:
};

explicit ButtonEventHandler(SubWidget* self);
~ButtonEventHandler();
virtual ~ButtonEventHandler();

bool isActive() noexcept;
void setActive(bool active, bool sendCallback) noexcept;
@@ -117,7 +117,7 @@ public:
explicit KnobEventHandler(SubWidget* self);
explicit KnobEventHandler(SubWidget* self, const KnobEventHandler& other);
KnobEventHandler& operator=(const KnobEventHandler& other);
~KnobEventHandler();
virtual ~KnobEventHandler();

// returns raw value, is assumed to be scaled if using log
float getValue() const noexcept;
@@ -154,6 +154,15 @@ private:
struct PrivateData;
PrivateData* const pData;

/* not for use */
#ifdef DISTRHO_PROPER_CPP11_SUPPORT
KnobEventHandler(KnobEventHandler& other) = delete;
KnobEventHandler(const KnobEventHandler& other) = delete;
#else
KnobEventHandler(KnobEventHandler& other);
KnobEventHandler(const KnobEventHandler& other);
#endif

DISTRHO_LEAK_DETECTOR(KnobEventHandler)
};



+ 8
- 0
dgl/NanoVG.hpp View File

@@ -23,6 +23,10 @@
#include "TopLevelWidget.hpp"
#include "StandaloneWindow.hpp"

#ifdef _MSC_VER
# pragma warning(disable:4661) /* instantiated template classes whose methods are defined elsewhere */
#endif

#ifndef DGL_NO_SHARED_RESOURCES
# define NANOVG_DEJAVU_SANS_TTF "__dpf_dejavusans_ttf__"
#endif
@@ -964,4 +968,8 @@ typedef NanoSubWidget NanoWidget;

END_NAMESPACE_DGL

#ifdef _MSC_VER
# pragma warning(enable:4661)
#endif

#endif // DGL_NANO_WIDGET_HPP_INCLUDED

+ 2
- 2
dgl/src/Color.cpp View File

@@ -114,10 +114,10 @@ Color::Color(const Color& color1, const Color& color2, const float u) noexcept
interpolate(color2, u);
}

Color Color::withAlpha(const float alpha) noexcept
Color Color::withAlpha(const float alpha2) noexcept
{
Color color(*this);
color.alpha = alpha;
color.alpha = alpha2;
return color;
}



+ 5
- 3
dgl/src/Geometry.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -15,8 +15,10 @@
*/

#ifdef _MSC_VER
// instantiated template classes whose methods are defined elsewhere
# pragma warning(disable:4661)
# pragma warning(disable:4661) /* instantiated template classes whose methods are defined elsewhere */
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wconversion"
#endif

#include "../Geometry.hpp"


+ 1
- 1
dgl/src/OpenGL.cpp View File

@@ -678,7 +678,7 @@ void Window::PrivateData::renderToPicture(const char* const filename,
GLubyte* const pixels = new GLubyte[width * height * 3 * sizeof(GLubyte)];

glFlush();
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
glReadPixels(0, 0, static_cast<GLsizei>(width), static_cast<GLsizei>(height), GL_RGB, GL_UNSIGNED_BYTE, pixels);

fprintf(f, "P3\n%d %d\n255\n", width, height);
for (uint y = 0; y < height; y++)


+ 3
- 1
dgl/src/SubWidget.cpp View File

@@ -34,7 +34,9 @@ SubWidget::~SubWidget()
template<typename T>
bool SubWidget::contains(const T x, const T y) const noexcept
{
return Rectangle<double>(0, 0, getWidth()-pData->margin.getX(), getHeight()-pData->margin.getY()).contains(x, y);
return Rectangle<double>(0, 0,
static_cast<double>(getWidth()) - pData->margin.getX(),
static_cast<double>(getHeight()) - pData->margin.getY()).contains(x, y);
}

template<typename T>


+ 2
- 2
dgl/src/Window.cpp View File

@@ -220,10 +220,10 @@ void Window::setSize(uint width, uint height)
{
// fix width
if (reqRatio > ratio)
width = height * ratio;
width = static_cast<uint>(height * ratio + 0.5);
// fix height
else
height = width / ratio;
height = static_cast<uint>(static_cast<double>(width) / ratio + 0.5);
}
}
}


+ 1
- 1
distrho/src/DistrhoPluginInternal.hpp View File

@@ -355,7 +355,7 @@ public:

portGroupIndices.erase(kPortGroupNone);

if (const size_t portGroupSize = portGroupIndices.size())
if (const uint32_t portGroupSize = portGroupIndices.size())
{
fData->portGroups = new PortGroupWithId[portGroupSize];
fData->portGroupCount = portGroupSize;


Loading…
Cancel
Save