diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-09 23:03:54 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-18 16:53:47 +0100 |
commit | c70529c1ec1092d3317316534155344e498fa593 (patch) | |
tree | 3579cf39b113bf8f1f40d80c01a994005c1fb3c8 /src/common/string_util.cpp | |
parent | svc: Implement svcCreateTransferMemory (diff) | |
download | yuzu-c70529c1ec1092d3317316534155344e498fa593.tar yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.gz yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.bz2 yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.lz yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.xz yuzu-c70529c1ec1092d3317316534155344e498fa593.tar.zst yuzu-c70529c1ec1092d3317316534155344e498fa593.zip |
Diffstat (limited to 'src/common/string_util.cpp')
-rw-r--r-- | src/common/string_util.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 14f7037d8..a1360dd26 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -214,6 +214,15 @@ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t return std::string(buffer, len); } +std::u16string UTF16StringFromFixedZeroTerminatedBuffer(const char16_t* buffer, + std::size_t max_len) { + std::size_t len = 0; + while (len < max_len && buffer[len] != '\0') + ++len; + + return std::u16string(buffer, len); +} + const char* TrimSourcePath(const char* path, const char* root) { const char* p = path; |