diff options
author | FearlessTobi <thm.frey@gmail.com> | 2024-02-10 18:15:58 +0100 |
---|---|---|
committer | FearlessTobi <thm.frey@gmail.com> | 2024-02-19 19:20:40 +0100 |
commit | d5e4617ab5c8b7e72e2155de886135766ce61c7a (patch) | |
tree | 5d76b2101df594324bedb323bb5340e24ed7fa7c /src/core/file_sys/fs_string_util.h | |
parent | Merge pull request #13080 from FearlessTobi/scope-exit (diff) | |
download | yuzu-d5e4617ab5c8b7e72e2155de886135766ce61c7a.tar yuzu-d5e4617ab5c8b7e72e2155de886135766ce61c7a.tar.gz yuzu-d5e4617ab5c8b7e72e2155de886135766ce61c7a.tar.bz2 yuzu-d5e4617ab5c8b7e72e2155de886135766ce61c7a.tar.lz yuzu-d5e4617ab5c8b7e72e2155de886135766ce61c7a.tar.xz yuzu-d5e4617ab5c8b7e72e2155de886135766ce61c7a.tar.zst yuzu-d5e4617ab5c8b7e72e2155de886135766ce61c7a.zip |
Diffstat (limited to 'src/core/file_sys/fs_string_util.h')
-rw-r--r-- | src/core/file_sys/fs_string_util.h | 15 |
1 files changed, 15 insertions, 0 deletions
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 @@ -20,6 +20,11 @@ constexpr int Strlen(const T* str) { } template <typename T> +constexpr int Strnlen(const T* str, std::size_t count) { + return Strnlen(str, static_cast<int>(count)); +} + +template <typename T> constexpr int Strnlen(const T* str, int count) { ASSERT(str != nullptr); ASSERT(count >= 0); @@ -33,6 +38,11 @@ constexpr int Strnlen(const T* str, int count) { } template <typename T> +constexpr int Strncmp(const T* lhs, const T* rhs, std::size_t count) { + return Strncmp(lhs, rhs, static_cast<int>(count)); +} + +template <typename T> constexpr int Strncmp(const T* lhs, const T* rhs, int count) { ASSERT(lhs != nullptr); ASSERT(rhs != nullptr); @@ -52,6 +62,11 @@ constexpr int Strncmp(const T* lhs, const T* rhs, int count) { } template <typename T> +static constexpr int Strlcpy(T* dst, const T* src, std::size_t count) { + return Strlcpy<T>(dst, src, static_cast<int>(count)); +} + +template <typename T> static constexpr int Strlcpy(T* dst, const T* src, int count) { ASSERT(dst != nullptr); ASSERT(src != nullptr); |