From f6ae40617e85d577c6ab4e8e63da2fd7dc4b5ae0 Mon Sep 17 00:00:00 2001 From: kayomn Date: Sun, 19 Feb 2023 15:48:29 +0000 Subject: [PATCH] Fix compilation error in core::path constructor --- source/core/files.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/core/files.cpp b/source/core/files.cpp index 42cdd54..b159f02 100644 --- a/source/core/files.cpp +++ b/source/core/files.cpp @@ -21,10 +21,12 @@ export namespace core { this->buffer[max] = max; } - template constexpr path(char const(&text)[text_size]) { + template constexpr path(char const(&text)[text_size]) : path{} { static_assert(text_size <= max, "path cannot be longer than maximum length"); - copy(this->buffer, text.as_bytes()); - zero(slice{this->buffer}.sliced(text_size, max - text_size)); + + for (usize i = 0; i < text_size; i += 1) this->buffer[i] = text[i]; + + this->buffer[max] = max - text_size; } /** @@ -56,7 +58,7 @@ export namespace core { * Returns the tail pointer of the path name. */ char const * end() const { - return reinterpret_cast(this->buffer) + this->byte_size(); + return this->buffer + this->byte_size(); } /** @@ -96,7 +98,7 @@ export namespace core { } private: - u8 buffer[max + 1]; + char buffer[max + 1]; }; /**