diff --git a/src/expr.h b/src/expr.h index 7383d993..7109cf65 100644 --- a/src/expr.h +++ b/src/expr.h @@ -45,7 +45,7 @@ public: Expr *b; }; - Expr() { } + Expr() = default; Expr(double val) : op(Op::CONSTANT) { v = val; } static inline Expr *AllocExpr() diff --git a/src/group.cpp b/src/group.cpp index 0d48c98a..223af2e1 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -49,7 +49,7 @@ bool Group::IsVisible() { return true; } -size_t Group::GetNumConstraints(void) { +size_t Group::GetNumConstraints() { return SK.constraint.CountIf([&](Constraint const & c) { return c.group == h; }); } diff --git a/src/platform/gui.h b/src/platform/gui.h index 059df444..50bebc3e 100644 --- a/src/platform/gui.h +++ b/src/platform/gui.h @@ -107,7 +107,7 @@ void FatalError(std::string message); // A native settings store. class Settings { public: - virtual ~Settings() {} + virtual ~Settings() = default; virtual void FreezeInt(const std::string &key, uint32_t value) = 0; virtual uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) = 0; @@ -135,7 +135,7 @@ class Timer { public: std::function onTimeout; - virtual ~Timer() {} + virtual ~Timer() = default; virtual void RunAfter(unsigned milliseconds) = 0; virtual void RunAfterNextFrame() { RunAfter(1); } @@ -157,7 +157,7 @@ public: std::function onTrigger; - virtual ~MenuItem() {} + virtual ~MenuItem() = default; virtual void SetAccelerator(KeyboardEvent accel) = 0; virtual void SetIndicator(Indicator type) = 0; @@ -170,7 +170,7 @@ typedef std::shared_ptr MenuItemRef; // A native menu. class Menu { public: - virtual ~Menu() {} + virtual ~Menu() = default; virtual std::shared_ptr AddItem( const std::string &label, std::function onTrigger = std::function(), @@ -188,7 +188,7 @@ typedef std::shared_ptr MenuRef; // A native menu bar. class MenuBar { public: - virtual ~MenuBar() {} + virtual ~MenuBar() = default; virtual std::shared_ptr AddSubMenu(const std::string &label) = 0; @@ -222,7 +222,7 @@ public: std::function onScrollbarAdjusted; std::function onRender; - virtual ~Window() {} + virtual ~Window() = default; // Returns physical display DPI. virtual double GetPixelDensity() = 0; @@ -299,7 +299,7 @@ public: std::function onResponse; - virtual ~MessageDialog() {} + virtual ~MessageDialog() = default; virtual void SetType(Type type) = 0; virtual void SetTitle(std::string title) = 0; @@ -347,7 +347,7 @@ extern std::vector CsvFileFilters; // A native dialog that asks to choose a file. class FileDialog { public: - virtual ~FileDialog() {} + virtual ~FileDialog() = default; virtual void SetTitle(std::string title) = 0; virtual void SetCurrentName(std::string name) = 0; diff --git a/src/platform/guigtk.cpp b/src/platform/guigtk.cpp index 84037bc5..61181482 100644 --- a/src/platform/guigtk.cpp +++ b/src/platform/guigtk.cpp @@ -124,7 +124,7 @@ public: } } - ~SettingsImplGtk() { + ~SettingsImplGtk() override { if(!_path.IsEmpty()) { // json-c <0.12 has the first argument non-const if(json_object_to_file_ext((char *)_path.raw.c_str(), _json, diff --git a/src/platform/guinone.cpp b/src/platform/guinone.cpp index fe054518..31f37dcd 100644 --- a/src/platform/guinone.cpp +++ b/src/platform/guinone.cpp @@ -53,22 +53,24 @@ void FatalError(std::string message) { class SettingsImplDummy final : public Settings { public: - void FreezeInt(const std::string &key, uint32_t value) {} + void FreezeInt(const std::string &key, uint32_t value) override { + } - uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) { + uint32_t ThawInt(const std::string &key, uint32_t defaultValue = 0) override { return defaultValue; } - void FreezeFloat(const std::string &key, double value) {} + void FreezeFloat(const std::string &key, double value) override { + } - double ThawFloat(const std::string &key, double defaultValue = 0.0) { + double ThawFloat(const std::string &key, double defaultValue = 0.0) override { return defaultValue; } - void FreezeString(const std::string &key, const std::string &value) {} + void FreezeString(const std::string &key, const std::string &value) override { + } - std::string ThawString(const std::string &key, - const std::string &defaultValue = "") { + std::string ThawString(const std::string &key, const std::string &defaultValue = "") override { return defaultValue; } }; diff --git a/src/platform/utilunix.cpp b/src/platform/utilunix.cpp index bf7d7e3f..646affcc 100644 --- a/src/platform/utilunix.cpp +++ b/src/platform/utilunix.cpp @@ -54,8 +54,7 @@ void *AllocTemporary(size_t n) return (void *)&h[1]; } -void FreeAllTemporary(void) -{ +void FreeAllTemporary() { AllocTempHeader *h = Head; while(h) { AllocTempHeader *f = h; diff --git a/src/render/rendergl3.cpp b/src/render/rendergl3.cpp index f614548a..61e1084d 100644 --- a/src/render/rendergl3.cpp +++ b/src/render/rendergl3.cpp @@ -727,8 +727,8 @@ public: // Data EdgeRenderer::Handle handle; - virtual Canvas::Layer GetLayer() const override { return stroke.layer; }; - virtual int GetZIndex() const override { return stroke.zIndex; }; + Canvas::Layer GetLayer() const override { return stroke.layer; } + int GetZIndex() const override { return stroke.zIndex; } static std::shared_ptr Create(OpenGl3Renderer *renderer, const SEdgeList &el, Canvas::Stroke *stroke) { @@ -757,8 +757,8 @@ public: OutlineRenderer::Handle handle; Canvas::DrawOutlinesAs drawAs; - virtual Canvas::Layer GetLayer() const override { return stroke.layer; }; - virtual int GetZIndex() const override { return stroke.zIndex; }; + Canvas::Layer GetLayer() const override { return stroke.layer; } + int GetZIndex() const override { return stroke.zIndex; } static std::shared_ptr Create(OpenGl3Renderer *renderer, const SOutlineList &ol, Canvas::Stroke *stroke, @@ -788,8 +788,8 @@ public: // Data IndexedMeshRenderer::Handle handle; - virtual Canvas::Layer GetLayer() const override { return stroke.layer; }; - virtual int GetZIndex() const override { return stroke.zIndex; }; + Canvas::Layer GetLayer() const override { return stroke.layer; } + int GetZIndex() const override { return stroke.zIndex; } static std::shared_ptr Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh, Canvas::Stroke *stroke) { @@ -817,8 +817,8 @@ public: // Data IndexedMeshRenderer::Handle handle; - virtual Canvas::Layer GetLayer() const override { return fill.layer; }; - virtual int GetZIndex() const override { return fill.zIndex; }; + Canvas::Layer GetLayer() const override { return fill.layer; } + int GetZIndex() const override { return fill.zIndex; } static std::shared_ptr Create(OpenGl3Renderer *renderer, const SIndexedMesh &mesh, Canvas::Fill *fill) { @@ -856,8 +856,8 @@ public: bool hasFillBack; bool isShaded; - virtual Canvas::Layer GetLayer() const override { return fillFront.layer; }; - virtual int GetZIndex() const override { return fillFront.zIndex; }; + Canvas::Layer GetLayer() const override { return fillFront.layer; } + int GetZIndex() const override { return fillFront.zIndex; } static std::shared_ptr Create(OpenGl3Renderer *renderer, const SMesh &m, Canvas::Fill *fillFront, Canvas::Fill *fillBack = NULL,