From daf49f6230f6ce95bf256521acb4726289136cb2 Mon Sep 17 00:00:00 2001 From: Fayti1703 Date: Sun, 27 Aug 2023 12:33:16 +0200 Subject: [PATCH 1/3] Add explicit trivial copy-constructor to vec4 Shuts up a GCC warning about `memcpy` being used to copy an array of these. --- Source/Math/vec4.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Math/vec4.h b/Source/Math/vec4.h index bf1566861..98043f893 100644 --- a/Source/Math/vec4.h +++ b/Source/Math/vec4.h @@ -65,6 +65,8 @@ class vec4 { entries[3] = val; } + inline vec4(const vec4& vec) = default; + inline vec4& operator=(float param) { entries[0] = param; entries[1] = param; From d29f4b108637f440c697a1bbb1e3a932535503ff Mon Sep 17 00:00:00 2001 From: Fayti1703 Date: Sun, 27 Aug 2023 14:23:06 +0200 Subject: [PATCH 2/3] Delete copy constructor+assign of FontRenderer Copy constructor implementation resulted in UB, and this class doesn't appear to be copied at all. Easiest and safest solution for now. --- Source/Graphics/font_renderer.cpp | 4 ---- Source/Graphics/font_renderer.h | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Graphics/font_renderer.cpp b/Source/Graphics/font_renderer.cpp index 178863676..10daff5dd 100644 --- a/Source/Graphics/font_renderer.cpp +++ b/Source/Graphics/font_renderer.cpp @@ -221,10 +221,6 @@ FontRenderer::FontRenderer() { impl_ = new FontRendererImpl(); } -FontRenderer::FontRenderer(const FontRenderer &other) { - *impl_ = *other.impl_; -} - FontRenderer::~FontRenderer() { delete impl_; } diff --git a/Source/Graphics/font_renderer.h b/Source/Graphics/font_renderer.h index 2e7dfdc51..661588025 100644 --- a/Source/Graphics/font_renderer.h +++ b/Source/Graphics/font_renderer.h @@ -54,9 +54,11 @@ class FontRenderer { } void GetKerning(int face_id, char character_a, char character_b, FT_Vector* vec); FontRenderer(); - FontRenderer(const FontRenderer& other); + FontRenderer(const FontRenderer& other) = delete; ~FontRenderer(); + FontRenderer& operator=(const FontRenderer& other) = delete; + private: FontRendererImpl* impl_; }; From 624b02759bdeaeee75cf0fd09cb5eff25157606d Mon Sep 17 00:00:00 2001 From: Fayti1703 Date: Fri, 8 Sep 2023 17:25:54 +0200 Subject: [PATCH 3/3] Include when using uint32_t Potential fix for #111 --- Source/Internal/stopwatch.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Internal/stopwatch.h b/Source/Internal/stopwatch.h index 293a2758c..05989cc0b 100644 --- a/Source/Internal/stopwatch.h +++ b/Source/Internal/stopwatch.h @@ -23,6 +23,7 @@ #pragma once #include +#include void BusyWaitMilliseconds(uint32_t how_many);