commit 1adef358f4bfcf9b8eb8afcaf560cd6ad6db84f8
parent 9d8df7e122c688551d245775ded7130edbc0d295
Author: falkTX <falktx@falktx.com>
Date: Sun, 19 Sep 2021 12:20:08 +0100
More compiler warnings fixing
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
8 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/dgl/EventHandlers.hpp b/dgl/EventHandlers.hpp
@@ -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)
};
diff --git a/dgl/NanoVG.hpp b/dgl/NanoVG.hpp
@@ -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
diff --git a/dgl/src/Color.cpp b/dgl/src/Color.cpp
@@ -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;
}
diff --git a/dgl/src/Geometry.cpp b/dgl/src/Geometry.cpp
@@ -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"
diff --git a/dgl/src/OpenGL.cpp b/dgl/src/OpenGL.cpp
@@ -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++)
diff --git a/dgl/src/SubWidget.cpp b/dgl/src/SubWidget.cpp
@@ -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>
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -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);
}
}
}
diff --git a/distrho/src/DistrhoPluginInternal.hpp b/distrho/src/DistrhoPluginInternal.hpp
@@ -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;