diff --git a/dgl/EventHandlers.hpp b/dgl/EventHandlers.hpp index dddeb427..a460440e 100644 --- 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 index 08b8f50b..4a8fd52c 100644 --- 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 index 4aa6b45d..10382fbd 100644 --- 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 index 44e99185..eb8df6e5 100644 --- a/dgl/src/Geometry.cpp +++ b/dgl/src/Geometry.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2019 Filipe Coelho + * Copyright (C) 2012-2021 Filipe Coelho * * 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 index aa2c3960..eb619c3a 100644 --- 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(width), static_cast(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 index c4cfd0b8..32c93221 100644 --- a/dgl/src/SubWidget.cpp +++ b/dgl/src/SubWidget.cpp @@ -34,7 +34,9 @@ SubWidget::~SubWidget() template bool SubWidget::contains(const T x, const T y) const noexcept { - return Rectangle(0, 0, getWidth()-pData->margin.getX(), getHeight()-pData->margin.getY()).contains(x, y); + return Rectangle(0, 0, + static_cast(getWidth()) - pData->margin.getX(), + static_cast(getHeight()) - pData->margin.getY()).contains(x, y); } template diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index 7d27613c..c9d12df7 100644 --- 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(height * ratio + 0.5); // fix height else - height = width / ratio; + height = static_cast(static_cast(width) / ratio + 0.5); } } } diff --git a/distrho/src/DistrhoPluginInternal.hpp b/distrho/src/DistrhoPluginInternal.hpp index 011936a6..af82b84e 100644 --- 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;