From 239f4d149d93f70534297cf127e68ba57296e7f4 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 3 May 2021 13:38:12 -0400 Subject: [PATCH] [nostalgia/core/userland] Cleanup --- src/nostalgia/core/userland/glutils.cpp | 7 ++++--- src/nostalgia/core/userland/glutils.hpp | 16 +++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/nostalgia/core/userland/glutils.cpp b/src/nostalgia/core/userland/glutils.cpp index c9be7739..68597a1c 100644 --- a/src/nostalgia/core/userland/glutils.cpp +++ b/src/nostalgia/core/userland/glutils.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include "glutils.hpp" @@ -41,9 +42,9 @@ static ox::Result buildShader(GLuint shaderType, const GLchar *src, cons GLint status; glGetShaderiv(shader, GL_COMPILE_STATUS, &status); if (status != GL_TRUE) { - std::array errMsg; - glGetShaderInfoLog(shader, errMsg.size(), nullptr, errMsg.data()); - oxErrorf("shader compile error in {}: {}", shaderName, errMsg.data()); + ox::BString<1000> errMsg; + glGetShaderInfoLog(shader, errMsg.cap(), nullptr, errMsg.data()); + oxErrorf("shader compile error in {}: {}", shaderName, errMsg); return OxError(1, "shader compile error"); } return ox::move(shader); diff --git a/src/nostalgia/core/userland/glutils.hpp b/src/nostalgia/core/userland/glutils.hpp index ac0ccaeb..1b770d38 100644 --- a/src/nostalgia/core/userland/glutils.hpp +++ b/src/nostalgia/core/userland/glutils.hpp @@ -53,11 +53,11 @@ struct GLobject: public Base { constexpr GLobject() noexcept = default; - explicit constexpr GLobject(GLuint id) { + explicit constexpr GLobject(GLuint id) noexcept { this->id = id; } - constexpr GLobject(GLobject &&o): Base(ox::move(o)) { + constexpr GLobject(GLobject &&o) noexcept: Base(ox::move(o)) { id = o.id; o.id = 0; } @@ -66,11 +66,13 @@ struct GLobject: public Base { del(id); } - GLobject &operator=(GLobject &&o) { - this->~GLobject(); - Base::operator=(ox::move(o)); - id = o.id; - o.id = 0; + GLobject &operator=(GLobject &&o) noexcept { + if (this != &o) { + del(id); + Base::operator=(ox::move(o)); + id = o.id; + o.id = 0; + } return *this; }