diff options
author | lat9nq <lat9nq@gmail.com> | 2022-05-16 00:06:33 +0200 |
---|---|---|
committer | lat9nq <lat9nq@gmail.com> | 2022-05-16 00:06:33 +0200 |
commit | ffd3afcf2fec718c86d664ede2fa3801b8fc746c (patch) | |
tree | 5735e89ac2e9f58c1128c2c1ac323180b063f478 /src/common | |
parent | Merge pull request #8336 from abouvier/unspirv (diff) | |
download | yuzu-ffd3afcf2fec718c86d664ede2fa3801b8fc746c.tar yuzu-ffd3afcf2fec718c86d664ede2fa3801b8fc746c.tar.gz yuzu-ffd3afcf2fec718c86d664ede2fa3801b8fc746c.tar.bz2 yuzu-ffd3afcf2fec718c86d664ede2fa3801b8fc746c.tar.lz yuzu-ffd3afcf2fec718c86d664ede2fa3801b8fc746c.tar.xz yuzu-ffd3afcf2fec718c86d664ede2fa3801b8fc746c.tar.zst yuzu-ffd3afcf2fec718c86d664ede2fa3801b8fc746c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/string_util.cpp | 4 | ||||
-rw-r--r-- | src/common/string_util.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 703aa5db8..7a495bc79 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -178,6 +178,10 @@ std::wstring UTF8ToUTF16W(const std::string& input) { #endif +std::u16string U16StringFromBuffer(const u16* input, std::size_t length) { + return std::u16string(reinterpret_cast<const char16_t*>(input), length); +} + std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer, std::size_t max_len) { std::size_t len = 0; while (len < buffer.length() && len < max_len && buffer[len] != '\0') { diff --git a/src/common/string_util.h b/src/common/string_util.h index a33830aec..ce18a33cf 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h @@ -44,6 +44,8 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ #endif +[[nodiscard]] std::u16string U16StringFromBuffer(const u16* input, std::size_t length); + /** * Compares the string defined by the range [`begin`, `end`) to the null-terminated C-string * `other` for equality. |