From 26878548f0d7fac7c0c65fd92ae1aca940ab89ee Mon Sep 17 00:00:00 2001 From: Nik Date: Sun, 23 Jun 2024 18:45:13 +0200 Subject: [PATCH] includes/std: Fixed NullString not including null terminator and not checking for string end correctly --- includes/std/string.pat | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/std/string.pat b/includes/std/string.pat index cb37780..b2e2872 100644 --- a/includes/std/string.pat +++ b/includes/std/string.pat @@ -1,6 +1,7 @@ #pragma once import std.io; +import std.mem; /*! Libray to interact with strings. @@ -35,7 +36,8 @@ namespace auto std::string { @tparam DataType The type of the characters. */ struct NullStringBase { - DataType string[while($[$] != 0x00)]; + DataType string[while(std::mem::read_unsigned($, sizeof(DataType)) != 0x00)]; + DataType null_terminator; } [[sealed, format("std::string::impl::format_string"), transform("std::string::impl::format_string")]]; /**