From d5e4617ab5c8b7e72e2155de886135766ce61c7a Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Sat, 10 Feb 2024 18:15:58 +0100 Subject: fs: Add FileSystemAccessor classes --- src/core/file_sys/fs_string_util.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core/file_sys/fs_string_util.h') diff --git a/src/core/file_sys/fs_string_util.h b/src/core/file_sys/fs_string_util.h index 874e09054..c751a8f1a 100644 --- a/src/core/file_sys/fs_string_util.h +++ b/src/core/file_sys/fs_string_util.h @@ -19,6 +19,11 @@ constexpr int Strlen(const T* str) { return length; } +template +constexpr int Strnlen(const T* str, std::size_t count) { + return Strnlen(str, static_cast(count)); +} + template constexpr int Strnlen(const T* str, int count) { ASSERT(str != nullptr); @@ -32,6 +37,11 @@ constexpr int Strnlen(const T* str, int count) { return length; } +template +constexpr int Strncmp(const T* lhs, const T* rhs, std::size_t count) { + return Strncmp(lhs, rhs, static_cast(count)); +} + template constexpr int Strncmp(const T* lhs, const T* rhs, int count) { ASSERT(lhs != nullptr); @@ -51,6 +61,11 @@ constexpr int Strncmp(const T* lhs, const T* rhs, int count) { return l - r; } +template +static constexpr int Strlcpy(T* dst, const T* src, std::size_t count) { + return Strlcpy(dst, src, static_cast(count)); +} + template static constexpr int Strlcpy(T* dst, const T* src, int count) { ASSERT(dst != nullptr); -- cgit v1.2.3