Fix compilation error in core::path constructor

This commit is contained in:
kayomn 2023-02-19 15:48:29 +00:00
parent e64013f03b
commit f6ae40617e
1 changed files with 7 additions and 5 deletions

View File

@ -21,10 +21,12 @@ export namespace core {
this->buffer[max] = max;
}
template<usize text_size> constexpr path(char const(&text)[text_size]) {
template<usize text_size> 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<char const *>(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];
};
/**